Meta Information on Wordpress

Posted November 19 2005

Part of the initial reason for staring this website, was a little project to get to No1 in the major search engines with a list of certain keywords.  I want to do this by white-hat methods. 

One of the methods search engines look at it Meta-Information, this includes key words and a description of the current page.  I wanted to add this information to each page easily. 

Now for each post I write I add the following custom fields to each

  • meta-keywords
  • meta-description

For each one, I fill in relevant information.

To have this information appear within the top of each page, I had to modify the header.php file found within my current template directory. The following code should be added within the head section of the page, between lines 5 and 7.

 <? if (get_post_meta($wp_query->post->ID, "meta-description", true) != "") { ?>post->ID, "meta-description", true); ?>" /> <? } ?>

<? if (get_post_meta($wp_query->post->ID, "meta-keywords", true) != "") { ?>post->ID, "meta-keywords", true); ?>" /><? } ?>

These will only appear on the post / archive pages themselves. So you will need to click on the article title first before viewing the source.


More on Custom Fields, and SEO

Further infomation on custom fields can be found on the WordPress Codex

In order to get the current post id, I found this post in the support forum.

What I know about search engine optimisation can be written on a stamp, but google knows all.

comments powered by Disqus