WordPress.org

Support

Support » Plugins and Hacks » Hacking header code to allow unique title tags on post pages only

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

  • billiardsblogger
    Member

    @billiardsblogger

    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*/

  • The topic ‘Hacking header code to allow unique title tags on post pages only’ is closed to new replies.