Modify Title Tag in WordPress posts

The default WordPress page titles for single-post pages are usually not in a very SEO-friendly form.┬ For example, in the template I am using, the title for a single post looks like: TopCat Blog ┬╗ Blog Archive ┬╗ Converting from Blogger to WordPress.

This is not good for SEO because the title of the post is at the end of the <title> tag.┬ I want to convert this into a title that includes just the title of the post.

The original template code is as follows:

<title><?php bloginfo(‘name’); ?> <?php if ( is_single() )┬ { ?> ┬╗ Blog Archive <?php } ?> <?php wp_title(); ?></title>

For a page containing a single post (this is where the is_single() function is true), the title tag is [Blog Name] ┬╗ [Blog Archive] [Post Title].┬ To change this to just [Post Title], the code above was modified as follows:

<title><?php if ( is_single() ) { } else { bloginfo(‘name’); } ?><?php wp_title(”); ?> </title>

This gives me what I want:┬ The post title for single-post pages, and the blog title for the main blog page.┬ Note that I gave the function wp_title an argument.┬ Without this argument, WordPress automatically put in a separator “┬╗” in front of the post title.┬ ┬ In this case, the title would look like “┬╗ Converting from Blogger to WordPress”.┬ By┬ giving ” as┬ the argument,┬ I am telling WordPress to use nothing as┬ the separator.