Easily Editable Meta Description for Individual Pages
Posted on October 26, 2009 and last modified on October 26th, 2009.
“SEO, SEO, SEO!“, screams the Net wherever you surf these days. And one big area they will rave about when discussing Search Engine Optimisation [SEO], is making sure you use valid and well thought out Meta Descriptions.
The trouble with the basic WorPress installation though, is that it does not allow you to make much headway in this area. Yes, I know there are many plugins available to cater for this need, but just for moment, let’s NOT use a plugin for this.
By adding the following code to our little functions.php file, we can make it so that in all of your pages [not posts], you can write a valid, and more importantly, DIFFERENT meta description by simply writing in your excerpt box.
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="description" content="<?php
if (is_single() || is_page()) {
# Single post / page.
# Use the 'description' custom field.
echo get_post_meta($post->ID, 'description', true);
} elseif (is_category()) {
# Category page.
# Use category's description
echo trim(strip_tags(category_description()));
} else {
# Default meta description
# Blog's description
echo bloginfo('description');
}
?>" />













[...] editable META DESCRIPTION [...]