Skip to content

Instantly share code, notes, and snippets.

@bondarolik
Created August 30, 2012 03:22
Show Gist options
  • Save bondarolik/3522002 to your computer and use it in GitHub Desktop.
Save bondarolik/3522002 to your computer and use it in GitHub Desktop.
Custom keywords including tags and category list within (hardcoded in header.php)
<meta name='keywords' content='<?php echo $keywords; ?>' />
<meta name='description' content='<?php echo $description; ?>' />
<?php
# Add to top
# Should be in theme options as functions
$keywords = "define, here, your, default, seo, keywords";
if (is_home()) {
$description = get_bloginfo('description');
} else if (is_single()) {
$description = $post->post_title;
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag ) {
$tagslist .= $tag->name . ", ";
}
$keywords = $keywords.", ".$tagslist;
}
else if (is_category()) {
$description = category_description();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment