WordPress.org

Ready to get started?Download WordPress

Forums

The Loop, show two outputs of content? (3 posts)

  1. ntarantino
    Member
    Posted 3 years ago #

    Is it possible to have the loop grab the latest posts and make that featured then display the 6 posts prior to that in a new div below?

    DIV - FEATURE
    H2 Heading
    DIV - Recent Posts

    Thanks

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

  3. vtxyzzy
    Member
    Posted 3 years ago #

    Something similar to this should work:

    <?php $max_featured = 2;  // Number of featured posts to show
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    if (have_posts()) :
       while (have_posts()) : the_post();
          if ($paged == 1 && $post_count++ < $max_featured) {
             // Do the featured div
          } else {
             // Do the recent div
          }
       endwhile;
    else:
       // Nothing found
    endif;

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.