• I’d like to be able to format the most recent post differently then the rest of the posts. But the only solutions I can find require two queries and just offset the posts, which screws with the posts on the next page being one off as well.

    So is there a way to just specify that on the home/index the latest post has x formating, and everything else will be formated y, but without screwing up the next page’s count.

Viewing 3 replies - 1 through 3 (of 3 total)
  • a basic metho is to use a counter varable, and a conditional statement:

    if (have_posts()) :
    $counter=1;
       while (have_posts()) :
          the_post();
    if( $counter==1 && !is_paged() ) {
    /*first post format; title, content, etc*/
    } else {
    /*all other posts format; title, content, etc*/
    }
       endwhile;
    endif;
    Thread Starter John Leschinski

    (@picard102)

    I wasn`t able to get that to work as expected. What it did was take the first style and apply it to all the post on the first page, rather then just the latest post, and styled the rest of the pages in the second style.

    ooooh – i forgot the code to increment the counter:

    if (have_posts()) :
    $counter=1;
       while (have_posts()) :
          the_post();
    if( $counter==1 && !is_paged() ) {
    /*first post format; title, content, etc*/
    } else {
    /*all other posts format; title, content, etc*/
    }
    $counter++;
       endwhile;
    endif;
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Latest Post Formating’ is closed to new replies.