So there’s problems with the default WordPress page titles; Descuentos the display order, and the separator. We’re going to take a look at those problems post – why are they problems? – and we’ll examine some solutions.
The problem with default WordPress titles
The default WordPress title displays something like this:
[blog name] » [category name] » [post title]
There are two key problems here:
- Item order: The order of the items in the title should read from most specific to least specific (left-to-right). So Hello the post title should be first, and the blog title should cheap mlb jerseys be last. This makes them more readable and useful in lists of favourites, for example.
- The separator: The separator shouldn’t be anything that needs to be escaped and it should be something that comes out nice in screenreaders, too. Here’s an article at 456 Berea Street regarding document titles and separators. I find this comment in particular to be most useful.
The solution
Let’s take echte a look at the standard code:
<title>
<?php bloginfo('name'); ?>
<?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?>
<?php wp_title(); ?>
</title>
We’ll reshuffle this as follows:
<title>
<?php wp_title(' '); ?>
<?php if(wp_title(' ', false)) { echo ' - '; } ?>
<?php bloginfo('name'); ?>
</title>
So you can see the title of the current page/post comes first. ‘wp_title’ takes an empty string as a parameter; this parameter denotes the separator. We’re not wholesale MLB jerseys using the default, and since we’ve reversed the order, we don’t need wholesale jerseys to display a separator at all.
We then have an ‘if’ statement that checks if the ‘wp-title’ holds a value and displays a separator, ‘ cheap NFL jerseys – ‘, if it does.
Lastly, we display the name of the blog with bloginfo(‘name’).
So now we get this in our title bar:
[post title] – [category name] – [blog name]
Much friendlier!
Some useful links
- Document titles and title separators.
- Template Tags/wp title – from the WordPress documentation
- How to use the title tag.
Cheers Dan, I worked out that I can edit the header.php file pretty easily, and it’s all good. I tried the netcocepts plugin, but I kinda broke the blog, so I reverted back. all good now tho
Pingback: two seven » Blog Archive » More WordPress title modification
And there is what some alternative? 😉
If yοu aгe going for finest contennts like myѕelf, only pay a quick visit tÒ»iÑ• website alll the timme forr tÒ»e reason tÒ»at Ñ–t Ïresents feature â…½ontents, thanks