WordPress.org

Ready to get started?Download WordPress

Forums

Fixing titles on browser tabs (6 posts)

  1. mattreilly
    Member
    Posted 1 year ago #

    Hi

    I've been trying to work out how to fix how the titles of my WordPress website and its pages appear on browser tabs.

    I came across this old thread:
    http://wordpress.org/support/topic/how-to-change-tittle-on-browser-tab

    In that thread the advice below is given:

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

    That's your title tag. It displays the blog name when a visitor is on the front page. Otherwise, it displays the page's title."

    But mine doesn't look like that.

    The only mentions of title in my header.php are in the chunk I've copied out below. I'm not sure which bit I need to amend to make the browser tab titles work properly. I have no understanding of the technical wizardry that makes WordPress work, so I'm completely in awe of anyone who can help me sort this out! Thanks in advance for any help anyone can offer me.

    <head>
    <meta name="google-site-verification" content="E1rhjkoazTctq7v8UA8nwUiGLAP0g9SF_inpTduWSTs" />
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
    <!--[if lt IE 9]>
    <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
    <![endif]-->
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
    	<header id="masthead" class="site-header" role="banner">
    		<hgroup>
    			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    		</hgroup>

    One page of my website is here - http://www.mattreilly.com/contact-me/ - you can see the problem in the browser tab.

  2. Justin
    Member
    Posted 1 year ago #

    Please see revised code

    <head>
    <meta name="google-site-verification" content="E1rhjkoazTctq7v8UA8nwUiGLAP0g9SF_inpTduWSTs" />
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width" />
    <title><?php if(is_front_page()) { echo bloginfo('name'); } else { wp_title(''); } ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
    <!--[if lt IE 9]>
    <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
    <![endif]-->
    <?php wp_head(); ?>
    </head>
    
    <body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
    	<header id="masthead" class="site-header" role="banner">
    		<hgroup>
    			<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    			<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    		</hgroup>
  3. mattreilly
    Member
    Posted 1 year ago #

    Hi Justin

    Thanks for your speedy reply.

    I copied and pasted the code into the part of header.php I'd copied the original code from, then updated header.php, but nothing's changed.

    I did a refresh on my browser to make sure I wasn't just seeing the old version, but nope - I'm still getting the titles of pages and the name of the website on the tabs clashing against one another.

    See here, where the website's title is picked up twice: http://www.mattreilly.com/blog/

    And here too: http://www.mattreilly.com/contact-me/

    Any ideas? Thanks, Matt.

  4. mattreilly
    Member
    Posted 1 year ago #

    I'm still stuck with this - I've trawled the web for answers and none of the fixes I find actually work for me. Anyone got any ideas?
    Cheers
    Matt

  5. alchymyth
    Forum Moderator
    Posted 1 year ago #

    I've been trying to work out how to fix how the titles of my WordPress website and its pages appear on browser tabs.

    and how do you want them to appear?

    more important - unmentioned so far - your are using an SEO plugin;
    <!-- All in One SEO Pack 1.6.15.3 by Michael Torbert of Semper Fi Web Design[409,444] -->
    in which case it might be the best just to leave the meta title code as it was in the unedited theme: <title><?php wp_title( '|', true, 'right' ); ?></title>

    and control the output through the plugin;
    if in doubt, ask in the plugin's support section http://wordpress.org/support/plugin/all-in-one-seo-pack

  6. mattreilly
    Member
    Posted 1 year ago #

    Hi alchymyth

    Yes, as mentioned previously - I have no idea how most of this stuff works. I have been tinkering around the edges with plug-ins and trying to learn the basics, but there are certain things that haven't gone quite to plan, like this.

    How I want them to appear is with my website's name on one side and the specific page on the other. This works on the Service page - 'Services | Matt Reilly Copywriter' but there seem to be issues on the last two (Blog and Contact Me).

    But if this is an issue with the plug-in, I guess I'll ask their support for help.

    Cheers anyway for the advice.

    Matt

Topic Closed

This topic has been closed to new replies.

About this Topic