Each web pages on Internet will normally has a title that is displayed on the top of all web browsers, and become description or title for the tab on tabbed-browsing support browsers such as Firefox and IE7 or IE8, and also as descriptive text when the browser window is minimized to taskbar. The webpage title is also important for SEO, acronym for search engine optimization, which intends to promote and improve the ranking of the page and site on search engines.
WordPress blogging system uses wp_title() template tag to call and displays or returns the title of the page. Previously, wp_title function is straight forward, and without flexibility, where the separator is always displayed in front of the page title, making bloggers and webmasters unable to put post and page title in front of website name, which believed to be able to boost search engine ranking due to more unique and different titles instead of a standard website title.
As before WordPress v2.5, wp_title tag is pretty much static, a lot of users rely on Optimal Title plugin to achieve the the optimization to move the post and page title to the front of blog or site title. However, there is no longer a need for any plug-in from WordPress version 2.5 onwards.
WordPress 2.5 has added a separator location argument to built-in wp_title template tag that allows users to define whether the separator should be printed before or after the title of the page. As such, bloggers who upgrade to WordPress 2.5 or new WordPress 2.5 installation can directly use the WordPress built-in wp_title function instead of additional plugin to optimize the blog pages title.
Typically, most WordPress theme design will have the following line of code to display a page title:
<title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
The code will print blog name first, followed by wp_title which firstly print a seperator, which by default is » (») symbol, and then continue with post title or page title. To change the separator location to the right or behind the post title so that the sequence of blog title and post title can be changed, simply change the code to the following:
<title><?php wp_title(' »', true, 'right'); ?> <?php bloginfo('name'); ?></title>
The values for first two parameters are default, which can be omitted, but some users reportedly that the WordPress will return 500 Internet Server Error when first 2 values are removed. Beside, some bloggers may want to beautify the title with space or change the separator, so it’s recommended to type in the value want to use. Note the the last argument determine the location of the separator, which must have the value of ‘right’ for the separator to be appended after the post title. Any other value will have the separator placed in front of (to the left of) the post title.
Usage and Parameters for wp_title() since WordPress 2.5
<?php wp_title('sep', echo, 'seplocation'); ?>
sep (string): Text to display before or after of the post title (i.e. the separator). By default (if sep is blank) then the » (») symbol will be placed before or after (specified by the seplocation) the post title.
echo (boolean): Echo the title (True) or return the title for use as a PHP string (False). Valid values is either 1 (True) which is also default value and 0 (False).
seplocation (string): Defines the location of where the sep string prints in relation to the title of the post. For all values except ‘right’, the sep value is placed in front of (to the left of) the post title. If the value of seplocation is ‘right’ then the sep string will be appended after the post title.
- BBC iPlayer Finally Arrives on Windows Phone 8 Free Download
- Viber Desktop for Windows & Mac Desk with Video Calling Feature
- Enable SugarSync to Sync External USB and Network Drives
- Sony Xperia ZR Waterproof Smartphone Allows Underwater Full HD Video Shooting
- How to Access Files to SD Cards and Flash Key Drives For Modern Windows 8 Apps