Page Titles.
Go into header.php and replace the <title> whatever is in the title tag </title> with:
<title><?php if (is_home()) {bloginfo('name') ;} else { wp_title(' ');} ?></title>
What this does is for the home page, it uses the blog’s title for the Title tag and for everything else, it will use the title of the blog post or page for the Title tag.
If you really want your blog name in all your posts, use this:
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { ?> | <?php } ?><?php bloginfo(‘name’); ?></title>
Only time I use this is when I think people will be searching for my blog or my whole blog name is all keywords;)
You can also skip this if you decide to use the great NetConcepts Title Tag Plugin
Header Tags
Blog title header
Also in header.php, but could also be in index.php (if it’s in index.php, you will need to change home.php)
Look for the h1 tag, it’s usually between <div id=”header”> </div>.
Replace the <h1>whatever is in the h1 tag </h1> with:
<?php
if(is_single() || is_page() || is_archive()){
?>
<div id="page_header"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></div>
<?php
} else
{ ?><h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1>
<?php } ?>
When it’s on single, page, or archive, it will use <div id=”page_header”>. Any other time such as the front page, it will use the default h1 tag. You ALWAYS use only one h1 tag and put your most important keywords at the start of the <h1>, but don’t do this religiously though or google will think you’re spamming. Make sure there isn’t any higher numbered headers before the h1 tag.
Now you’ll need to go into your css file, it’s usually (95%) style.css.
Find occurrences of h1 and add on #page_header
Using Beach House’s css file. The first occureance of h1 is
#header h1
font-size: 22px;
text-align: right;
padding-right: 40px;
padding-top: 60px;
}
Your want to add #page_header like this:
#header h1, #header #page_header{
font-size: 22px;
text-align: right;
padding-right: 40px;
padding-top: 60px;
}
Since the above h1 was for the id header, you want to keep page_header in the same id. The next h1 tag in Beach House is
h1, h2, h3 {
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-weight: bold;
}
With addition, it would be:
h1, h2, h3, #page_header {
font-family: ‘Trebuchet MS’, ‘Lucida Grande’, Verdana, Arial, Sans-Serif;
font-weight: bold;
}
Go and find all h1 tags and add the #page_header <div> id. Some of the h1 tags you won’t need to add the #page_header if they’re under another class like comments/sidebar/etc. You’ll just have to do trial/error to see which one you need to do, but if you’re good at css, it shouldn’t take you long, but if you don’t know anything about css and have problems with a theme you will probably need some help.
Single/Page Headers
The reason we set the blog header for the page.php and single.php with a <div>is so we can use the h1 tag for the blog post/page title.
Go to single.php (if there isn’t a single.php, just save as index.php as single.php).
Find the header tag that houses the blog post title (usually <h2> and has <?php the_title(); ?>) and change the header to <h1 id=”single_header”> (don’t forget to close it with </h1>)
For example with our theme example:
<h2><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h2>
to
<h1 id="single_header"><a href="<?php echo get_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a></h1>
Now we’ll need to go into the css file. Find all the <h2> and add on h1#single_header like how we did the blog title above.
So for the first occurrence of h2 that needs #single_header in the css for our example
h2 {
font-size: 1.6em;
}
to this
h2, h1#single_header
{
font-size: 1.6em;
}
Sidebars
Most of the sidebars in templates use <h2> for the headers for each sidebar item, we don’t want to use <h2> for those because there is no SEO value for highlighting Meta, Blogroll, Pages, Archives, Categories, and etc. Instead we want to put them in <div> instead.
For our example, we replace all <h2> with <div class=”sidebar_header”>, don’t forget to replace the closing tags!
Go into the css file to see if there a #sidebar id in there, most of them, all you really need to do is change the h2 out with a div.sidebar_header
Change:
#sidebar h2{
font-family: 'Lucida Grande', Verdana, Sans-Serif;
font-size: 1.2em;
}
To:
#sidebar .sidebar_header {
font-family: 'Lucida Grande', Verdana, Sans-Serif;
font-size: 1.2em;
}
Find reset of the h2 that needs to be changed.
Sidebar Widgets
You’ll also need to switch out the <h2> out of the function file. Open up functions.php.
For our example, change
if ( function_exists('register_sidebars') )
register_sidebars(1);
to
if ( function_exists('register_sidebars') )
register_sidebar(array(
'before_widget' => '<li>',
'after_widget' => '</li>',
before_title' => '<div class="sidebar_header">',
'after_title' => '</div>',
));
Now every widget item title will have <div class=”sidebar_header”> instead of the default <h2>
Comment/Respond Headers
Most of the time, the comment and respond titles use <h2> or some header. We want to change those to <div>
Those items are usually housed in comments.php, but sometime they’re also in single.php. You won’t need to add any extra ids on to them because they are already there, so just change h2 to div.
Using our example template, the first item to change is
h1, h2, h3, #page_header{
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-weight: bold;
}
Add div#comments, div#respond so it looks like this:
h1, h2, h3, #page_header, div#comments, div#respond {
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
font-weight: bold;
}
Go find all other instances and add or change the h2
Other Headers
Some templates use headers in other places when they shouldn’t, make sure to do the same thing as we did above. You always want the <h1> first, <h2> second, and so on. Only one <h1>, 3-4 <h2>, and etc.
Duplicate Content
Wordpress is notorious when it comes to make duplicate content. The archives, categories, and even the front page can cause duplicate content issues which is bad for SEO.
Insert the following between the <header> tags
<?php
if((is_home() && ($paged < 2 )) || is_single() || is_page() || is_category()){
echo '<meta name="robots" content="index,follow" />';
} else {
echo '<meta name="robots" content="noindex,follow" />';}
?>
Now, only the page, home, and single page will be indexed, everything else will be set to noindex.
When you’re writing posts, make use of the <!–more–> tag in the wordpress Write Post screen. You want to use this so you don’t have your entire post indexed twice (once in the front and once in post view). In the WYSISYG editor, you can just click on this icon:

Make a text file named robots.txt with
User-agent: Googlebot
Disallow: /*/feed/$
Disallow: /*/feed/rss/$
Disallow: /*/trackback/$
User-agent: *
Disallow: /wp-
Disallow: /feed/
Disallow: /trackback/
Disallow: /rss/
Disallow: /comments/feed/
Disallow: /page/
Disallow: /date/
Disallow: /comments/
Put this in your root directory.
If you changed the directory names, make sure the above robots.txt and won’t screw up your site, but 99% of the time you won’t need to change anything.
Change Permalink Structure
Go to the Wordpress admin and goto the options menu, in the submenu goto Permalinks.
For custom structure, use:
/%category%/%postname%/
or
/%postname%/
I would personally just use /%postname%/ unless you plan on using the same post titles.
.htaccess
Default Htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
In your .htaccess file add the following 2 lines at the end.
RewriteCond %{http_host} ^DOMAIN.com [nc]
RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [r=301,nc]
Change DOMAIN to your domain name.
So it looks like:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{http_host} ^DOMAIN.com [nc]
RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [r=301,nc]
</IfModule>
Make sure: “RewriteEngine On” is also in the htaccess (default for Wordpress Htaccess).
From now on, all your domains will redirect to www.blogtitle.com if you use type blogtitle.com. This is to stop canonicalization.
Note, this only works for Apache servers. If you are running on a Windows server, you can grab this component to do the same thing: ISAPI_Rewrite.
Sitemaps, meta keywords, meta descriptions, even better titles, related posts, permanent redirect
These will be done through free Wordpress plugins. Check out my upcoming plugins guide!
From MyTypes.com
Posted by admin |
No Comments »