I\'m new to WordPress and just installed version 3.3.1.
I did some googling regarding this question and found some answers but they were relevant to version 2.7 and
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...
The new hack from Codex is as follows:
<title><?php wp_title(''); ?></title>
Then in your "functions.php" from theme file :
add_filter( 'wp_title', 'baw_hack_wp_title_for_home' );
function baw_hack_wp_title_for_home( $title )
{
if( empty( $title ) && ( is_home() || is_front_page() ) ) {
return __( 'Home', 'theme_domain' ) . ' | ' . get_bloginfo( 'description' );
}
return $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.
no need. Just add the <? Php wp_head ();?>
Code at the end of the header.php
good luck.
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>
I use this method in my WordPress site
//Meta Header
if ( ! function_exists( 'dima_wp_title' ) ) :
function dima_wp_title( $title ) {
if ( is_front_page() ) {
return get_bloginfo( 'name' ) . ' | ' . get_bloginfo( 'description' );
} elseif ( is_feed() ) {
return ' | RSS Feed';
} else {
return trim( $title ) . ' | ' . get_bloginfo( 'name' );
}
}
add_filter( 'wp_title', 'dima_wp_title' );
endif;