• I’d like the first post on the first page to be displayed in full and then all other posts to be displayed as excerpts. And then page two would be all excerpts.

    I’ve found other posts about this topic, but it seems like none of their code lines up with my loop or index. And on this topic, I’m clearly out of my depth.

    Here’s my loop code:

    <?php if(!is_single()) : global $more; $more = 0; endif; //enable more link ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class("post clearfix $class"); ?>>
    
    	<h1 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
    
    	<p class="post-meta">
    		<span class="post-author">by <?php the_author_posts_link() ?></span>
    		<span class="post-time"> | <time datetime="<?php the_time('o-m-d') ?>" class="post-date" pubdate><?php the_time('F j, Y') ?></time> | </span>
    		<!-- span class="post-category"> | <?php the_category(', ') ?></span> -->
    		<?php the_tags(' <span class="post-tag">', ', ', '</span>'); ?>
    		<?php if ( comments_open() ) : ?>
    			<span class="post-comment"><?php comments_popup_link( __( '0 Comment', 'themify' ), __( '1 Comment', 'themify' ), __( '% Comments', 'themify' ) ); ?></span>
    		<?php endif; //post comment ?>
    	</p>
    
    	<?php the_content('<p><span class="readmore">Read More &rarr;</span></p>'); ?>
    
    	<?php edit_post_link(__('Edit', 'themify'), '[', ']'); ?>
    
    </article>
    <!-- /.post -->
Viewing 3 replies - 1 through 3 (of 3 total)
  • try and change this line:

    <?php the_content('<p><span class="readmore">Read More →</span></p>'); ?>

    for instance, to:

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

    (@johnnygjr)

    Ahhhh! Thanks so much.

    That code is so much simpler than the garbage I saw posted elsewhere. Beautiful.

    Thanks again.

    Thread Starter johnnygjr

    (@johnnygjr)

    So I just realized after playing around with my site a little more that this formatting carries over on every page, not just the index.php. Is there any conditional code I can add to the loop to show all excerpted on all other pages minus the homepage?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Different first post on first page only’ is closed to new replies.