WordPress wp_title blank on index page
But if you use a static home page, this is the code:
<title><?php bloginfo('name'); ?> » <?php is_front_page() ? bloginfo('description') : wp_title(''); ?></title>
Here's is what I read from Codex:
If you are using a custom homepage with custom loops and stuff, you will have an empty
wp_title
. Here goes a neat hack to add the description/tagline at thewp_title
place on homepage:
<title><?php bloginfo('name'); ?> | <?php is_front_page() ? bloginfo('description') : wp_title(''); ?></title>
So use is_front_page()
to get the title on homepage, the way it is suggested in above code.
Update for WordPress versions (>= 4.4)
Try this
function some_name(){
add_theme_support( 'title-tag' );
}
add_action( 'after_setup_theme', 'some_name' );
Do this in functions.php and remove 'title' tag from head...