How to adjust the title for every article in WordPress

Posted by NosaLee in WordPress Experience on 10-03-2012.

Author: Nosa Lee
Original Address: http://www.seeksunslowly.com/adjust-wordpress-blog-title
To reprint this article, please indicate the source, thank you.
_____________________________________

The title format may not be to your satisfaction in current WordPress theme, if you want adjust it, please click “Appearance -> Editor -> Header (header.php)” in the control panel, and adjust the content between <title></title>

I use following title code and think it is good, for your reference.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<title>
<?php
/*
 * Print the <title> tag based on what is being viewed.
 */

global $page, $paged;

wp_title( '|', true, 'right' );

// Add the blog name.
bloginfo( 'name' );

// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
   echo " | $site_description";

// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
   echo ' | ' . sprintf( __( 'Page %s', 'twentyeleven' ), max( $paged, $page ) );

?>
</title>

Post a comment