Adding Code on <head> of posts of specific categories

Discussion in 'WordPress' started by prabhakar, Oct 13, 2009.

  1. #1
    I want to add a script code into <head> of single post pages of specific categories. How can I do that?
     
    prabhakar, Oct 13, 2009 IP
  2. Big0ne

    Big0ne Well-Known Member

    Messages:
    2,615
    Likes Received:
    81
    Best Answers:
    0
    Trophy Points:
    165
    #2
    Do you mind sharing what do you want to add in head? Any specific META tag or...
     
    Big0ne, Oct 13, 2009 IP
  3. nichoLora

    nichoLora Peon

    Messages:
    67
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Step1. You should create another header with your code...
    Step2: In single .php insert:

    <?php
    if ( in_category('3')) {
    include(TEMPLATEPATH . '/newly-created-header.php');
    } else {
    get_header();
    }
    ?>
    Of course you will need to change the category id and header name
    This should work.
     
    nichoLora, Oct 15, 2009 IP