1

I have this in my header.php file ->

<title><?php is_front_page() ? bloginfo('description') : wp_title(''); ?> - <?php bloginfo('name'); ?></title>

This shows title in my browser window for all pages except one. I looked from my admin panel under the Pages section, if there are something missing, but did not find anything(or did not know where to look). Where should I look to solve this problem and what should I edit?

  • Which page not show title? Did you select a default page for front view (in Settings->Reading->Front page displays)? – skywind Jan 9 '15 at 13:50
  • I have a nav bar with different pages and one of them if Blog. If I click on the Blog button, it does not show title in browser window, but if I click on something else, it shows title perfectly – student Jan 9 '15 at 13:56
  • I have selected A static page from Settings -> Readings and my Front Page is called Home and Posts page is called Blog. But this Blog does not show title, but if I click on Blog and then select some article, it shows the title as well. – student Jan 9 '15 at 13:58
2

to show the page title for the page set as the 'blog' or 'posts page', you need to add some code, maybe via a filter on wp_title();

example:

add_filter( 'wp_title', 'wpse_174379_show_posts_page_wp_title' );
function wpse_174379_show_posts_page_wp_title( $title ) {
    if( get_option( 'page_for_posts' ) ) { 
        $posts_page = get_post( get_option( 'page_for_posts') ); 
        $title = ' ' . $posts_page->post_title . ' ';
    }
    return $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.