• Resolved marques_uk

    (@marques_uk)


    Hi everyone,

    I have yet another excerpts question.

    Is there a way to make all your posts on the main blog page excerpts rather than show full posts?

    I’m using the loop.php file from the twentyten theme, I can change the_content() function to the_excerpt() however that just makes all posts excerpts rather than just the posts page as expected.

    Is there a way to edit the code below so it includes the page listed as the posts page in Settings > Reading?

    <?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 : ?>

    Thanks in advance
    marques_uk

Viewing 5 replies - 1 through 5 (of 5 total)
  • if ( is_home() || is_archive() || is_search() ) :

    Thread Starter marques_uk

    (@marques_uk)

    Hi,

    This doesn’t work for me, I’m using a static page so I also tried is_front_page()?

    I’m using a page called ‘Our Blog’ as my posts page.

    Any other ideas?

    Many thanks

    the conditional statement occurs more than once in loop.php – have you edited it all?

    btw: this question has been answered before and should be found using forum search.

    This doesn’t work for me, I’m using a static page so I also tried is_front_page()?

    I’m using a page called ‘Our Blog’ as my posts page.

    should make no difference;

    the conditional tag is_home() refers to the posts page:

    https://codex.www.ads-software.com/Function_Reference/is_home
    https://codex.www.ads-software.com/Conditional_Tags#The_Main_Page

    alternatively, you can edit this whole section:

    <?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; ?>

    and change it to:

    <div class="entry-summary">
    				<?php the_excerpt(); ?>
    			</div><!-- .entry-summary -->

    again, make sure to find and edit all occurrances in loop.php

    Thread Starter marques_uk

    (@marques_uk)

    Thanks for your help. I’ll go through and edit the loop.php file.

    I had searched the WordPress forums for this solution, and did find similar questions however must answers were replace the_content() with the_excerpt() and to be honest I didn’t realise the conditional tag is_home() refers to the posts page that isn’t my home page as well.

    Least I know for future projects.

    Thanks again.

    YOu can use <?php if( is_page('5') ) { ?> instead of is_home() ; Replace 5 with your page id which you are using for showing post. I am sure you may have found the solution, but I think it would be helpful for someone else also.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Make posts page show excerpts()’ is closed to new replies.