WordPress.org

Ready to get started?Download WordPress

Forums

Hacking header code to allow unique title tags on post pages only (1 post)

  1. billiardsblogger
    Member
    Posted 7 years ago #

    Hey everyone,
    I use a plugin called SEO Meta Editor to rename my title/description/keyword tags. This plugin allows me to set these fields when I create a post. I pasted and bolded the code that this plugin requires that I place in my header file at the bottom of this post.

    Problem is that I only want this renaming to happen on post pages - not the homepage. I assume I want to use some sort of conditional tag (is_home maybe) to say that this renaming process should not affect the homepage.

    I would like to find a way to define these tags for the homepage once - then have this plugin do the same for all post pages. Any advice would be GREATLY appreciated.
    Thanks in advance

    To see the site where this is occuring: http://www.billiardsblogger.com

    <?php
    global $wp_query, $post;
    $meta_description=get_post_meta($post->ID, "html_meta_description",true);
    $meta_keywords=get_post_meta($post->ID, "html_meta_keywords", true);
    $meta_title=get_post_meta($post->ID, "html_meta_title", true);

    if($meta_keywords)
    print '<meta name="Keywords" content="'.$meta_keywords.'" />';
    if($meta_description)
    print '<meta name="Description" content="'.$meta_description.'" />';
    ?>
    <?
    if($meta_title)
    print "<title>$meta_title</title>";
    else
    {
    ?>

    <title>
    <?php if(is_home()) { bloginfo('title'); echo ' - '; bloginfo('description'); } else { wp_title(''); echo ' - '; bloginfo('name'); } ?>
    </title>
    <?
    }
    ?>

    /*For Reference - here is the URL of the plugin Readme.
    http://www.cheekyo.com/wp-content/plugins/meta_editor_README.txt*/

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 7 years ago by billiardsblogger
  • This topic is not resolved
  • WordPress version: 2.1.1