我希望我的第一篇文章有不同的风格,并且位于当前文章的上方。我只喜欢在定制风格的设计中获得第一篇文章,其余的文章就像以前一样。顶帖宽度将为1188px。如果有人知道如何做到这一点,我会很高兴。谢谢。如何在wordpress页面上以不同格式显示第一篇文章?
下面是我想要的图片,第一张图片显示了当前情况,下一张图片显示了我想要实现的内容。
我当前的PHP项目在这里:
<?php get_header(); ?>
<!-- Begin Content -->
<div id="content-a">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post">
<div class="imgdiv"><a href="<?php the_permalink() ?>"><img src="<?php echo catch_that_image() ?>" width="250"></a></div>
<div class="p-heading"><h1><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1></div>
<div class="p-content">
<?php the_excerpt(); ?>
</div>
<div class="p-info"><?php the_time('j.m.Y') ?> | <?php the_category(', '); ?> | <img src="http://www.virmodrosti.com/wp-content/uploads/comments.png" alt="Komentarji" width="26" height="12"><?php $totalcomments = get_comments_number(); echo $totalcomments; ?></div>
</div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('Naslednja stran') ?></div>
<div class="alignright"><?php previous_posts_link('Prejšnja stran') ?></div>
<div class="clear"></div>
</div>
<?php else : ?>
</div>
<div id="content">
<div class="post">
<div class="p-heading"><h1 class="center">Ni najdeno</h1></div>
<div class="p-content"><p class="center">Oprostite, ampak iščete nekaj kar ni tukaj.</p>
</div>
</div>
<?php endif; ?>
</div>
<!-- End Content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
为什么不使用特定CSS样式仅定位在后列表中的第一个孩子?根本不需要担心循环中发生了什么。 – Korgrue