Optimize your WordPress theme for Search Engines – Part 1

By Jeremy Clark
Filed In wordpress  |  Tagged , , ,  |  180 views
TOP       digg

WordPress Recently I was updating my themes, and I got to thinking about SEO a little and about how to apply it to a theme to help out the blog author. One of the biggest complaints with WordPress 2.7 is the comment pagination and duplicate content. Google detects the comment pages as duplicate even when the comments are different. The easiest thing is to append comment page N to the title and meta description. To do this you need to edit the header.php of your theme and add this between the <title> </title> tags.

<title><?php if ( is_single() ) { wp_title(''); if ( $cpage < 1 ) {}
else { echo (' - comment page '); echo ($cpage);} ?> | <?php } ?><?php bloginfo('name'); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if ($paged > 1) { echo " - Page $paged"; } ?></title>

I’ll explain the code now. The first if finds if it is a single post or page then it prints the title of the post or page first then the second if finds if its a comment page then it appends – comment page 1 and so on to the title. Next is the | which serves as a separator for the title of the post and title of the blog. Next the name of the blog is printed then next comes some code to find if the current page is a older posts page and if it is then it prints Page 2 and so on. This is also to eliminate duplicate title tags. Tomorrow I’ll go over how to pull an excerpt and make it the meta description which is also helpful for your search rank. You can follow the whole series here.

Related posts:

  1. WordPress 2.7 Comment Callback Function
  2. WordPress Theme Options Framework
  3. WordPress 2.7 Comment Threading
  4. Installing PHP v. 5
  5. New Theme
1 Star2 Stars3 Stars4 Stars5 Stars |  (No Ratings Yet)
Loading ... Loading ...

2 Comments

Leave a Reply

Want an Avatar like seen here. Sign up for Gravatar

Comments will be sent to the moderation queue.

Subscribe without commenting