0

The <title> of each page on my site shows correctly with the following code:

<title><?php wp_title(''); ?></title>

But on my home page, which is set to a static page called 'Home', the <title> attribute is blank. The HTML for 'Home' page looks like this:

<title></title>

The settings for the 'Home' page has 'Home' as the page title, but it doesn't show on the actual page output. Any idea why? The issue can be seen here.

3

From the Codex

If you are using a custom homepage with custom loops and stuff or a custom front-page, you will have an empty wp_title. Here goes a neat hack to add the description/tagline at the wp_title place on homepage:

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;
}
0

This works for me, place it in header.php:

<title><?php wp_title('');?><?php if(is_front_page()) {bloginfo('name');}?></title>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.