Skip to content

Instantly share code, notes, and snippets.

@kadavre
Last active December 28, 2015 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadavre/7411319 to your computer and use it in GitHub Desktop.
Save kadavre/7411319 to your computer and use it in GitHub Desktop.
WordPress does not support the use of meta description tags by default. Though metas have lost their significance in SEO, they can still influence the ranking of your blog in the search engines. To make your site search engine friendly, you should open the header.php file of your theme and copy and paste the code below to the space between the o…
<meta name="description" content="
<?php
if ((is_home()) || (is_front_page())){
echo ('Your main description goes here');
}elseif(is_category()){
echo category_description();
}elseif(is_tag()){
echo '-tag archive page for this blog' . single_tag_title();
}elseif(is_month()){
echo 'archive page for this blog' . the_time('F, Y');
}else{
echo get_post_meta($post->ID, "Metadescription", true);
}?>">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment