我希望我的第一篇文章的风格不同,并且位于当前帖子的上方。我只想在定制风格的设计中获得第一个帖子,其余的帖子就像它们已经存在一样。顶部帖子宽度为1188px。如果有人知道怎么做,我会很高兴。谢谢。
这是我想要的图片,第一张图片显示了当前的情况,下一张图片展示了我想要实现的目标。
我目前的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(); ?>
答案 0 :(得分:1)
<?php $i=1; ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php if ($i == 1){
// here do the custom look you want to give to 1st post, i am sorry i dont know html
<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 } else { ?>
<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 } $i++; ?>
<?php endwhile; ?>