Add meta description to your wordpress theme

October 27, 2008 · Print This Article

Open your header.php file. Paste the following code anywhere within the <head> and </head> tags:
<?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 } ?>

Good job! Your theme now have meta description on the homepage as well as single posts. Also, we should create another conditionnal structure to handle categories.


Related articles:

Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.