Before There Was A Geekette, There Was a Girl
RSS:
Publications
Comments

Wordpress: Using Tags as Keywords

If you work with websites, or even search the web, most likely you have heard of “keywords” on webpages. From google adwords to search engines, keywords have been used all over.

At different points, various search engines have placed (or not placed) value on keywords to search websites all over the internet. How many, the weight and value, which and when to use keywords now vary from search engine to search engine.

When creating a static website, it is easy to add the meta elements in the header. When creating a website with wordpress, various plugins can be used.

Another option in WordPress 2.6 is to edit your header.php file to use the tags in a post as your keywords. After tiring of using plugin after plugin and having more database entries than I wanted, I ended up just replacing the meta field for keywords with this snippit.

Not only will this use the tags for the post on the actual single, archive and index page, it will also do it in a way that if there are no keywords, it will still validate in XHTML 1.0 and not give an error.

<?php global $post;
if( is_single() || is_page() || is_home() ) :
$tags = get_the_tags($post->ID);
if($tags) :
foreach($tags as $tag) :
$sep = (empty($keywords)) ? ” : ‘, ‘;
$keywords .= $sep . $tag->name;
endforeach;
?>
<meta name=”keywords” content=”<?php echo $keywords; ?>” />
<?php
endif;
endif;
?>

This may or may not work in other versions of WordPress – it depends on if the version you are using uses get_the_tags

  • Share/Bookmark

12 Comments to Wordpress: Using Tags as Keywords

  1. 2009-12-3 at 3:03 am | Permalink

    You are right in what you have said. I was only thinking this the other day but I think I will now dig a little deeper. Not sure what the last guy meant though!

  2. 2009-08-9 at 2:34 am | Permalink

    Please post something on SEO basics as this blog is too good.

  3. 2009-08-7 at 4:01 pm | Permalink

    thanks for sharing i loved the blog.

  4. 2009-06-29 at 5:41 am | Permalink

    Interesting post, just signed up to your RSS feed, hope to find some more great content here :)

  5. 2009-06-25 at 4:14 pm | Permalink

    Iphone News, to get the captcha code just google “captcha code plugin”. It´s free.

  6. 2009-06-22 at 7:39 am | Permalink

    I have to say I’m really impressed with your posts and blog overall. I stumbled on your site accidentally but am now happy I did. I’ll be stopping in to read more often now. Thanks again !
    Thanks,
    Lou

  7. 2009-06-17 at 12:26 pm | Permalink

    It’s nice to finally find a site where the blogger knows what they are talking about.

  8. 2009-06-17 at 7:50 am | Permalink

    There is obviously a lot to know about this. I think you made some good points in this subject. So, just want to say great job!

  9. 2009-06-16 at 10:41 pm | Permalink

    Do you work in this industry? YOu seem to know a lot about the subject.

  10. 2009-06-8 at 12:40 pm | Permalink

    I strongly recommend that you turn the No Follow off in your comment section. I’ll watch Google Webmaster Tools, and if the links don’t show up after a couple of weeks — I won’t go back to that blog again. Another suggestion: you should have a Top Commentator widget installed. Do Follow and Top Commentator will ensure that you have a successful blog with lots of readers!

  11. 2009-04-13 at 12:35 pm | Permalink

    What is captcha code?, pls provide me captcha code codes or plugin, Thanks in advance.

  12. pc accessories's Gravatar pc accessories
    2009-01-15 at 12:17 am | Permalink

    Nice article, i love it, thanks for sharing

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv Enabled

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution. Please understand with hundreds of SPAM comments, it takes a while to sort through to approve the good comments. Sometimes, by accident, some good comments accidentally get marked as spam. Please let us know if your comment did not get posted. Also, if your comment has a link to it or anything else in it that would make it seem like spam, it will be deleted. So please post a real comment and not one that is only made to link to a site only. Otherwise, it could get deleted.