How to Show Meta Description as Post Excerpts in Blog’s Home page

You may want to show your blog post’s meta descriptions as post excerpts in your blog’s homepage. This may prove to be useful if  you do not want to use the more tag on any of your posts.

Most of the WordPress themes show only a portion of their post in the homepage using the more tag. That means, whatever you include before the “More tag” appears in your blog’s home page and the whole article appears  in the single post pages.

But The Question is “ What if I want to show my  post’s meta description in the home page as post excerpt and the whole article on single post pages ?

An example to Illustrate

Digital inspiration , a popular technology blog uses a similar feature in their homepage. They show the meta description as post excerpts in the homepage while the single post pages contain the entire article.

The Meta description can be added in your posts using All in One SEO pack a popular seo plugin for WordPress.

Following are the steps involved to show meta descriptions as post excerpts:

1. First back up the index.php file of your current WordPress theme so that if something goes wrong, you can restore things later.

2. Open the index.php file for editing and find the famous WordPress loop. The wordpress loop starts with

<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>

3. Find the code that shows the post content on the index page. A typical example is:

<?php the_content(‘Read more’); ?>


4. Replace  the above code with the following code :

<?php $home = get_post_meta($post->ID, ‘description’, true); ?>

<?php echo $home; ?>

That’s it. Now your blog’s homepage will show the article’s meta description as post excerpts. If you do not add meta descriptions in any  post, no post excerpts will be shown for that article on the homepage. It will only show the title of the article.

Note: Applying the above method shows the meta description as post excerpt in the homepage only. But the category, tag and archive pages will still show the content you are using  just before the more tag. To show the post’s meta description in all your pages, you have to edit the WordPress loop of index.php, page.php and archive.php files. I hope you get the idea.

(Related – Basic On-page SEO Best Practices for new WordPress Blogs)

By the way I am not showing any meta description on the home page as post esxcerpts. I am happy with the in built more tag !