Special Offer: Buy All 48 Premium WordPress Themes for Just $74.99. 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. Install and Activate the WP Editor plugin: https://wordpress.org/plugins/wp-editor/

It is a very useful plugin which allows you to edit files inside all of the theme folders:

WP Editor Plugin

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

3. Open yourtheme/inc/utilities.php

4. Find the following code:

function tishonator_the_content() {

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

5. 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

6. 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.

About the Author

Tihomir Ivanov is a WordPress web developer, founder of tishonator.com, a fan of Linux and Open Source, a gym enthusiast, a vegan, a fan of minimalism, good movies and books :)

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

Leave a Reply