WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Make posts page show excerpts() (6 posts)

  1. marques_uk
    Member
    Posted 2 years ago #

    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

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    if ( is_home() || is_archive() || is_search() ) :

  3. marques_uk
    Member
    Posted 2 years ago #

    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

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    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:

    http://codex.wordpress.org/Function_Reference/is_home
    http://codex.wordpress.org/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

  5. marques_uk
    Member
    Posted 2 years ago #

    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.

  6. singhabhishek251
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic