Optimize your WordPress theme for Search Engines – Part 2

WordPress

Today I’m showing how to add your meta descripition to your blog. Google will use this as the description that shows up in it’s search results which can help with click through if you write good excerpts about your posts. If you don’t have a specific excerpt written then wordpress automatically grabs the first 55 words which may or may not be very descriptive of your post. It’s always a good practice to manually write your excerpt to give a summary of a post.

First I’ll post the code that needs to go into your header.php file between the <head> </head> then I’ll explain the pieces and what the do

[php]
<?php if (is_single() || is_page() ) : if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<meta name="description" content="<?php $excerpt = strip_tags(get_the_excerpt());
echo $excerpt; if ( $cpage < 1 ) {}
else { echo (‘ – comment page ‘); echo ($cpage);} ?>" />
<?php endwhile; endif; elseif(is_home()) : ?>
<meta name="description" content="<?php bloginfo(‘description’); ?>" />
<?php endif; ?>
[/php]

The if (is_single() || is_page() ) determines if the current page is a single post or a single page. Next is this if ( have_posts() ) : while ( have_posts() ) : the_post(); this is mini loop to pull in the excerpt for the current post or page. Next this code pulls the excerpt and strips any html tags from it to display a clean excerpt $excerpt = strip_tags(get_the_excerpt()); echo $excerpt;. After that is the comment page code again to elimanate duplicate meta tags with google if ( $cpage < 1 ) {} else { echo (' - comment page '); echo ($cpage);}. The last bit of code is if it's just the home page then the tagline from the blog is displayed. That's it for section. Tomorrow I'll go over how to add your tags and categories to the meta keywords, some say search engines don't pay much attention to these but it doesn't hurt to have them. You can follow the whole series here. Be sure and rate each post, thanks.

Posted in wordpress | Tagged , , | 3 Comments

Optimize your WordPress theme for Search Engines – Part 1

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.

[php light=”true”]
<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>
[/php]
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.

Posted in wordpress | Tagged , , , | 2 Comments

Windows 7 may allow IE8 to be disabled

Windows 7 w/o IEDon’t like IE then you might be able to ditch it in Windows 7, a leaked beta has the feature to turn off IE8. Some speculated it because of the whole EU thing. The 7048 build of the beta has this feature, although not available in the public beta it’s easy enough to find on your favorite torrent site.
Source: CNet News – Microsoft may let Windows 7 users turn browser off

Posted in microsoft | Tagged , , , | Comments Off on Windows 7 may allow IE8 to be disabled

I’ve moved again

Hopefully this will be the last time for awhile. I’ve got a new domain name without the no-ip attached. All links should still work, if not let me know.

Posted in Aside | Tagged | 1 Comment

Slightly Updated Look

As you can tell I’ve updated a few parts of my blog, namely the nice tabbed interface for the sidebar, and going with one sidebar split into two columns at the bottom. Tell me what you think of it, I always appreciate feedback.

Posted in tech | Tagged , | Comments Off on Slightly Updated Look