25 November 2008

How To Add HTML Meta Description Tag in Wordpress Theme

Many search engine spiders read the description meta tag, instead of keywords meta tags.

In many wordpress themes does not have description meta tag in html headers.
There are several plugins for adding meta tags, but I will show you an easy way to add it without plugin install.

Open your header.php file in your templates folder, and add the code below and save it.
 <meta name="Description" content=" <?php if(is_home())
{ echo get_bloginfo('name'); }

if(is_single() or is_page())
{single_post_title('', true);}
else if(is_category())
{single_cat_title();}
else if(is_archive())
{wp_title('');}
else if(is_search())
{wp_title('');}
else {wp_title('');} ?> " />
This code will add description html meta tag with the title of your post or category,
this will positively improve your seo (search engine optimization),
your content and the meta tag relevancy will increase.

1 comment:

Anonymous said...

Nice way of explaining importance of meta tags. Whether it's blog or a website, you can not ignore meta tags if you want your blog or site to get ranked in search engine.
website design