/ Published in: PHP
If Else loop
Expand |
Embed | Plain Text
<?php $count = 0; query_posts('showposts=5'); if (have_posts()) : while (have_posts()) : the_post(); $count++; ?> <?php if ($count == 1) : ?> <ul id="featured-main"> <h3 class="sec-header"><span><?php the_time('F d, Y'); ?></span></h3> <li> <h2 class="entry-title"><a href="<?php the_permalink() ?>" title="Permalink to <?php the_title_attribute() ?>" rel="bookmark"><?php the_title() ?></a></h2> <div class="author">By <?php the_author_posts_link(); ?></div> <div class="thumbnail"><a href="<?php the_permalink() ?>" title="Permalink to <?php the_title_attribute() ?>" rel="bookmark"><?php the_post_thumbnail('big-post-thumbnail'); ?></a></div> <div class="meta"> <span class="date"> <?php the_time('F d, Y'); ?></span> <span class="categories"><?php the_category(', ') ?></span> <span class="comments"><?php comments_popup_link('0 Comment', '1 Comment', '% Comments', 'comments-link'); ?></span> </div> <?php the_excerpt(); ?> </li> </ul><!--featured-main--> <?php else : ?> <div id="featured-news"><!--still in grid_6--> <ul> <li> <h2><a href="<?php the_permalink() ?>" title="Permalink to <?php the_title_attribute() ?>" rel="bookmark"><?php the_title() ?></a></h2> <div class="meta"> <span class="date"> <?php the_time('F d, Y'); ?></span> <span class="categories"><?php the_category(', ') ?></span> <span class="comments"><?php comments_popup_link('0 Comment', '1 Comment', '% Comments', 'comments-link'); ?></span> </div> <?php if(has_post_thumbnail()) { ?> <div class="thumbnail"><a href="<?php the_permalink() ?>" title="Permalink to <?php the_title_attribute() ?>" rel="bookmark"><?php the_post_thumbnail(); ?></a></div> <?php } ?> <?php the_excerpt(); ?> </li> </ul> </div><!--featured-news--> <?php endif; ?> <?php endwhile; wp_reset_query(); ?> <?php endif; ?>
You need to login to post a comment.
