WordPress.org

Forums

Add Meta Tags
[resolved] Probelm with meta tags in header.php (3 posts)

  1. kevinj003
    Member
    Posted 2 years ago #

    I've just installed the Add-Meta_Tags plugin, and it seems to be working well. I have configured it so I can manually add keywords and descriptions on a page by page basis. However, the header.php file for my theme already included meta tags for author, contact, copyright, description and keywords. When I remove these meta tags from header.php, (so I can add separate description and keyword tags for each page) my header banner is not displaying correctly. The code at the to of the header.php file is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    
    <title><?php wp_title('«', true, 'right'); ?> <?php bloginfo('name'); ?></title>
    
    <meta http-equiv="author" content="Amphibian Ark" />
    <meta http-equiv="contact" content="webmaster@amphibianark.org" />
    <meta name="copyright" content="Copyright (c)2006-2011 Amphibian Ark. All Rights Reserved." />
    <meta name="description" content="The Amphibian Ark is a joint effort of three principal partners: the World Association of Zoos and Aquariums (WAZA), the IUCN/SSC Conservation Breeding Specialist Group (CBSG), and the IUCN/SSC Amphibian Specialist Group (ASG). We were formed to address the ex situ components of the Amphibian Conservation Action Plan (ACAP)." />
    <meta name="keywords" content="amphibian, conservation, save, frog, toad, newt, salamander, caecilian, ex situ, in situ, ark, aark, capacity building, survival, crisis, chytrid, chytridiomycosis, bd, fungus, assessment, training, newsletter, donate, zoo, aquarium, museum, university, private, rescue, extinction, husbandry, science, research, education, curriculum, extinct, threatened, endangered, amphibian conservation, donate," />
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    <?php if(is_single() || is_page() || is_home()) { ?>
        <meta name="googlebot" content="index,noarchive,follow,noodp" />
        <meta name="robots" content="all,index,follow" />
      <meta name="msnbot" content="all,index,follow" />
    <?php } else { ?>
        <meta name="googlebot" content="noindex,noarchive,follow,noodp" />
        <meta name="robots" content="noindex,follow" />
      <meta name="msnbot" content="noindex,follow" />
    <?php }?>
    
    <!--[if IE 6]>
    	<style type="text/css" media="screen">
    		<?php include_once('ie6.php'); ?>
    	</style>
    <![endif]-->
    
    <?
    //generate random header
    $possibleHeaders = array("header.jpg", "header2.jpg", "header3.jpg", "header4.jpg", "header5.jpg", "header6.jpg", "header7.jpg", "header8.jpg", "header9.jpg");
    $randomHeader = array_rand($possibleHeaders);
    ?>
    <style type="text/css" media="screen">
    #header{
    	background:url(%3C?php\ bloginfo\(\'stylesheet_directory\') no-repeat 0 0;
    	height:218px
    }
    </style>
    
    <?php wp_head(); ?>

    When I remove the 5 meta tag lines, the code which selects a random header image:

    <?
    //generate random header
    $possibleHeaders = array("header.jpg", "header2.jpg", "header3.jpg", "header4.jpg", "header5.jpg", "header6.jpg", "header7.jpg", "header8.jpg", "header9.jpg");
    $randomHeader = array_rand($possibleHeaders);
    ?>
    <style type="text/css" media="screen">
    #header{
    	background:url(%3C?php\ bloginfo\(\'stylesheet_directory\') no-repeat 0 0;
    	height:218px
    }
    </style>

    no longer works, and no header image is displayed.

    An example page can be seen at http://www.amphibianark.org/aark-activities/ Viewing the source of this page shows 2 sets of meta tags (the ones in header.php and those generated by Add-Meta-Tags), and I understand that having 2 sets of meta tags is not a good thing.

    Can anyone let me know how to overcome this problem?

    Thanks in advance.

    http://wordpress.org/extend/plugins/add-meta-tags/

  2. kevinj003
    Member
    Posted 2 years ago #

    I have resolved this issue :-)

  3. George Notaras
    Member
    Plugin Author

    Posted 2 years ago #

    OK. Thanks for letting me know. I am marking this thread as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Add Meta Tags
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic