Profile image for Joshua Canfield jcanfield
Without the use of a plugin you can still accomplish an SEO friendly Description meta tag. This is just a series of IF-THEN-ELSE statements that shows a description or excerpt depending on the page/post that your on. As always, constructive criticism is welcome. You can always shout at me on Twitter, http://twitter.com/CreativeBoulder/.
Language
PHP
Tags
description meta description meta tag php seo wordpress

SEO Friendly Wordpress Description Meta tag

1 <meta name="description" content=" 2 <?php 3 if (is_home() || is_front_page() ) { 4 bloginfo('name'); echo " | "; bloginfo('description'); 5 } 6 elseif ( is_single() ) { 7 if (!empty($post->post_excerpt)) { 8 the_excerpt(); 9 } 10 else { 11 single_post_title('', true); 12 } 13 } 14 elseif ( is_category() ) { 15 echo category_description(); 16 } 17 else { 18 echo 'Entered a detailed description of this page or post and possibly use page variables to create a unique description.'; 19 } 20 ?> 21 ">

Discussion

If you have any alternatives or suggestions for this snippet, please do comment. It will be much appreciated. Design and development is all about collaboration. If we can collaborate on our personal projects and applications then we can apply that knowledge to our client projects.

Comments