WordPress SEO: Add meta description to your theme

Hello friends
Today I am going to show how to add meta description in your wordpress custom theme. Unfortunately there is no meta data in wordpress default theme except the page title and description. Its very easy to write only few line of code.

 

<?php if (  (is_home()) || (is_front_page())  ) { ?>
<meta name="description" content="Blog description goes here" />
<?php } elseif (is_single()) { ?>
<meta name="description" content="<?php the_excerpt();?>"/>
<?php } ?>

Oky done. Just put this code into your head section and save it. Refresh and check the meat information again. 

Thanks for reading...
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s