• Resolved jzahlaway

    (@jzahlaway)


    I want my homepage to display the full text for all posts *EXCEPT* posts for which I have entered something into the “Excerpt” field, in which case I want the excerpt to appear on the homepage instead of the full text. Anybody know how to make this happen in 3.0? (I had written a hack for it in earlier versions, but the code has changed significantly in 3.0.)

Viewing 6 replies - 1 through 6 (of 6 total)
  • you could try:

    <?php
    if($post->post_excerpt) { the_excerpt(); }
    else { the_content('read more...'); }
    ?>
    Thread Starter jzahlaway

    (@jzahlaway)

    OK. Where? And in place of what?

    I can’t believe this has to be hacked in rather than just an out-of-the-box option in WordPress. Surely I can’t be the only person who would like to use an excerpt in some instances, and the full post in others?

    I can’t believe this has to be hacked in

    have you not done it before?

    I had written a hack for it in earlier versions

    so, what is different this time?

    i am not saying that there is no other way of doing it; it is just the way i could think of just now.

    the code goes in place of either <?php the_excerpt(); ?> or <?php the_content('read more...'); ?> – whatever is in your index.php (or the template file showing your home page)

    Thread Starter jzahlaway

    (@jzahlaway)

    have you not done it before?

    As you already noted, I already answered that.

    so, what is different this time?

    The Twenty Ten theme is what’s different this time … and its loop.php file … and all of the code therein, which differs greatly from previous WordPress default themes. So I’m having trouble figuring out exactly where to put the hack.

    And I still say this should be a simple Dashboard option instead of a hack.

    knowing you are working with TwentyTwn makes iteasier:

    in loop.php about line 130:

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    			<div class="entry-summary">
    				<?php the_excerpt(); ?>
    			</div><!-- .entry-summary -->
    	<?php else : ?>
    			<div class="entry-content">
    				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    				<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    			</div><!-- .entry-content -->
    	<?php endif; ?>
    Thread Starter jzahlaway

    (@jzahlaway)

    Awesome. Thanks for the help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to display a mix of excerpts and full text on homepage?’ is closed to new replies.