Some time ago I wrote about re-working WordPress titles to make them easier to read, and more search engine-friendly.
Since then I’ve done a bit more work on WordPress, and so I thought I’d share a few WordPress title modications I’ve used in a recent project.
I’m also going to throw in some
modifications, since
and
contents are fairly similar.
The
You got that? Good.
Okay, so what I did was take the reshuffled code, as follows:
… and prepended a piece of code to check if this is a search page, and if so, show the search query, like this: Search for "" -
So we get:
Search for "" -
So if you did a search for “free iPhones”, your browser’s title bar would show:
“Search for “Free iPhones” – Your Site Name”
It’s nothing amazing, but just makes the
that much more useful.
The
This is a unique title for a given page.
There should be — according to me, anyway — just one
element per page.
Here’s some code to look at:
Search for "" -
Well, that’s rather hard on the eyes, isn’t it? One day I’ll move this blog off the default WordPress template and onto something that makes code chunks look better.
It’s all wrapped in an ‘if’ statement that checks to see if this is the home page. If it is, then the
contains just the name of the site:
bloginfo('name');
If this is not the home page, then the
element contains the page title as per the
element above, wrapped in an
element that links back to the home page:
... title code ...
So there you have it.
Again, I’m sorry this is so hard to read; maybe one day I’ll go into a bit more detail.
Let me know if anything here requires further clarification.