• Resolved johnnygjr

    (@johnnygjr)


    Thanks to a user on here a week or so ago, I was able to get the first post the display in full and then all others as excerpts. The problem is that it does this for every single page, when all I want is for this to occur on the homepage. And then I want all subsequent pages to display ONLY excerpts.

    Here’s the code I’m currently using in loop.php:

    <?php if( $wp_query->current_post == 0 ) the_content('<p><span class="readmore">Read More &rarr;</span></p>'); else the_excerpt(); ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • How about using the is_home() function to identify the home page?

    <?php if( $wp_query->current_post == 0 && is_home()) the_content('<p><span class="readmore">Read More &rarr;</span></p>'); else the_excerpt(); ?>

    Thread Starter johnnygjr

    (@johnnygjr)

    I just realized that I actually want the first post, first page to work sitewide. For example, on Category pages I want the first post to appear in full. So I want the second page (and everything after) of any type (posts, category, search) to only display excerpt.

    Sorry I didn’t realize that sooner.

    <?php if( $wp_query->current_post == 0 && !is_paged() ) the_content('<p><span class="readmore">Read More &rarr;</span></p>'); else the_excerpt(); ?>

    https://codex.www.ads-software.com/Function_Reference/is_paged

    Thread Starter johnnygjr

    (@johnnygjr)

    is_paged. Beautiful.

    Thanks, alchymyth and linux. Much appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘First post different on homepage ONLY’ is closed to new replies.