I’m really getting into developing child themes for Thematic. It’s a really powerful theme framework.
I’ll try to post some of the more interesting bits of code I write to help the Thematic community at large.
Here, I’ve used a nice little meta-description function from Life On Mars’s WordPress SEO 101 article and turned it into a function that you can simply add to your childtheme’s functions.php file:
// Add a custom meta-description
function childtheme_meta_description() { //divydovy: put the Life On Mars code in a wrapper function ?>
ID, "MetaDescription", true);
// checks to see if the custom field MetaDescription is not empty
if ($custommeta !=='') {echo $custommeta;}
// check if excerpt exists for the post and output it if it does
elseif (!empty($post->post_excerpt)) {the_excerpt();}
// if there's no custom field or excerpt output the post title
else {single_post_title('', true);}
}
// if category page output the category description
elseif (is_category()) {echo category_description();}
// if it's any other page display this generic description
else { echo 'add your generic description here';}
?>"
/>
add_action('wp_head', 'childtheme_meta_description'); //divydovy: add this function to the wp_head hook
Hey presto! A customisable meta-description facility with redundancy for your Thematic child theme 🙂
Props to Life On Mars.