Site logo

Archived topic

Two title tags

4 replies · Started by morriscountynj on January 5, 2017

Viewing posts 1–5 of 5

Very strange issue I'm having with my GP sites, and somehow I didn't notice it until now.

Every page has two title tags!

The first is the <title> via the All-in-One SEO plugin. The second is the <title> auto-generated by Wordpress.

If I disable All-in-One SEO, I STILL GET TWO TITLES. It's seriously bizarre.

I was wondering if you've ever encountered this with GP, and if it might have anything to do with the theme.

If it helps, I'm using a child theme with a custom header.php, here's the <head> code:

<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<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 
wp_head();
$generate_settings = wp_parse_args( 
	get_option( 'generate_settings', array() ), 
	generate_get_defaults() 
);
?>
<script>
  $(".main-title").fitText();
</script>

</head>

Actually figured it would help more for you to see the whole of header.php:

<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <main id="main">
 *
 * @package Generate
 */
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<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 
wp_head();
$generate_settings = wp_parse_args( 
	get_option( 'generate_settings', array() ), 
	generate_get_defaults() 
);
?>
<script>
  $(".main-title").fitText();
</script>

</head>

<body itemtype="http://schema.org/WebPage" itemscope="itemscope" <?php body_class(); ?>>
	<?php do_action( 'generate_before_header' ); ?>
	<header itemtype="http://schema.org/WPHeader" itemscope="itemscope" id="masthead" role="banner" <?php generate_header_class(); ?>>
		<div <?php generate_inside_header_class(); ?>>
			<?php do_action( 'generate_before_header_content'); ?>
			

            
         	<?php generate_construct_logo(); ?>
            
            
			<?php if ( empty( $generate_settings['hide_title'] ) || empty( $generate_settings['hide_tagline'] ) ) : ?>
				<div class="site-branding">
                   <?php if ( empty( $generate_settings['hide_tagline'] ) ) : ?>
					<p class="site-description"><?php bloginfo( 'description' ); ?></p>
				<?php endif; ?>
                    
				<?php if ( empty( $generate_settings['hide_title'] ) ) : ?>
					<h1 class="main-title" itemprop="headline"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
				<?php endif; ?>
				
		
				
				</div>
            
<?php generate_construct_header_widget(); ?>
            
            
      
			
			
			<?php endif; ?>
			<?php do_action( 'generate_after_header_content'); ?>
		</div><!-- .inside-header -->
	</header><!-- #masthead -->
	<?php do_action( 'generate_after_header' ); ?>
	
	<div id="page" class="hfeed site grid-container container grid-parent">
		<div id="content" class="site-content">

<noscript>
<ul class="pagenav">
<?php wp_nav_menu( array(
    'menu' => 'main',
'depth' => 1
) ); ?>
</ul>
<style>
#site-navigation {display:none;}
.pagenav {margin:0 auto;text-align:center;}
.pagenav:after {content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;}
.menu-item {margin:0 2em 2em 0; list-style:none;float:left;}
 .my-account{background:none;}
  
</style>
</noscript>

			<?php do_action('generate_inside_container'); ?>

You need to remove this line as WordPress adds the title tag for you:

<title><?php wp_title( '|', true, 'right' ); ?></title>

got it, thanks!

You're welcome :)

This archived topic is closed to new replies.