contacts

Get All 146 Premium WordPress Themes for Just $59.99
One-Time Payment: Unlimited Use Across Unlimited Domains, Plus Free Lifetime Updates! Learn more

How to Display Posts Excerpt in Index Page

By default when open an index page, it will display the post contents there. You can insert ‘Read more’ tag into posts content to cut off the post content into these pages.

However, in some cases you may want to display posts excepts in index pages. Here all of the necessary steps you need to apply:

1. Navigate to Admin Panel -> Left Menu -> Appearance -> Theme Editor

2. Open yourtheme/inc/utilities.php

3. Find the following code:

function tishonator_the_content() {

the_content( __( ‘Read More’, ’tishonator’ ) );
}

4. Replace

the_content( __( ‘Read More’, ’tishonator’ ) );

with:

if ( is_single() ) {
the_content( __( 'Read More', 'tishonator' ) );
} else {
the_excerpt();
}
?>

<a href="<?php the_permalink(); ?>"><?php _e( 'Read More', 'tishonator' ) ?></a>

<?php

5. Save Changes

In this way, the content entered into ‘Excerpt’ section for a post will be displayed as post content in index pages: index, search results, archive, etc. Also, the excerpt content will be followed by a ‘Read More’ link pointing to the single post page.

One Response to “How to Display Posts Excerpt in Index Page”