• Hello,

    My blog titles do not appear in the browser bar. Instead, the site name and description are displayed. Here is the header file:

    <?php
    /**
    * The Header template for our theme
    *
    * Displays all of the <head> section and everything up till <div id=”main”>
    *
    * @package WordPress
    * @subpackage Twenty_Thirteen
    * @since Twenty Thirteen 1.0
    */
    ?><!DOCTYPE html>
    <!–[if IE 7]>
    <html class=”ie ie7″ <?php language_attributes(); ?>>
    <![endif]–>
    <!–[if IE 8]>
    <html class=”ie ie8″ <?php language_attributes(); ?>>
    <![endif]–>
    <!–[if !(IE 7) | !(IE 8) ]><!–>
    <html <?php language_attributes(); ?>>
    <!–<![endif]–>
    <head>
    <meta charset=”<?php bloginfo( ‘charset’ ); ?>”>
    <meta name=”viewport” content=”width=device-width”>
    <meta name=”msvalidate.01″ content=”53FB31D0D53241AEC0F6831DE4EF390C” />
    <title><?php bloginfo(‘name’); ?> | <?php bloginfo(‘description’); ?></title>
    <link rel=”profile” href=”https://gmpg.org/xfn/11″&gt;
    <link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>”>
    <!–[if lt IE 9]>
    <script src=”<?php echo get_template_directory_uri(); ?>/js/html5.js”></script>
    <![endif]–>
    <?php wp_head(); ?>
    </head>

    <body <?php body_class(); ?>>
    <div id=”page” class=”hfeed site”>
    <header id=”masthead” class=”site-header” role=”banner”>
    ” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”>
    <h1 class=”site-title”><?php bloginfo( ‘name’ ); ?></h1>
    <h2 class=”site-description”><?php bloginfo( ‘description’ ); ?></h2>

    <div id=”navbar” class=”navbar”>
    <nav id=”site-navigation” class=”navigation main-navigation” role=”navigation”>
    <h3 class=”menu-toggle”><?php _e( ‘Menu’, ‘twentythirteen’ ); ?></h3>
    “><?php _e( ‘Skip to content’, ‘twentythirteen’ ); ?>
    <?php wp_nav_menu( array( ‘theme_location’ => ‘primary’, ‘menu_class’ => ‘nav-menu’ ) ); ?>
    <?php get_search_form(); ?>
    </nav><!– #site-navigation –>
    </div><!– #navbar –>
    </header><!– #masthead –>

    <div id=”main” class=”site-main”>

    I tried replacing

Viewing 7 replies - 1 through 7 (of 7 total)
  • <title><?php bloginfo('name'); ?> | <?php bloginfo('description'); ?></title>
    Instead of this code try using wp_title() function.

    Thread Starter soasmw

    (@soasmw)

    Sorry for incomplete post.

    I tried replacing the <title> tag with many options, but they did not work.

    Thread Starter soasmw

    (@soasmw)

    @jacenty3590, that worked for the posts.

    However, the homepage now shows that static page title instead of the site title. How can I get it to show the site title?

    @soasmw
    You can use both bloginfo() and wp_title() functions at one time:
    <title><?php wp_title(' | ', true, 'right'); ?> <?php bloginfo('name'); ?></title>

    Thread Starter soasmw

    (@soasmw)

    That did not work, then I tried this:

    <title>

    <?php if (is_home ()) { bloginfo(‘name’); ?> | <?php bloginfo(‘description’); ?> }
    else
    { <?php wp_title(‘ | ‘, true, ‘right’); ?> }

    </title>

    But there is some syntax error.

    P.S: I am a beginner in coding.

    Try this code (taken from Twenty Eleven WordPress theme). Should work fine.

    <title><?php
    wp_title('|', true, 'right');
    
    bloginfo('name');
    
    $site_description = get_bloginfo( 'description', 'display' );
    	if ( $site_description && ( is_home() || is_front_page() ) )
    		echo " | $site_description";
    ?></title>
    Thread Starter soasmw

    (@soasmw)

    Now I have both the site title as well as the page title displaying. Perhaps because I am using wp_title() and bloginfo() together. Any improvements to this code?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Blog Title not appearing in browser bar’ is closed to new replies.