1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP in wordpress theme

Discussion in 'Content Management System' started by amber.long83, Dec 2, 2009.

  1. amber.long83

    amber.long83 New Member

    Joined:
    Nov 3, 2009
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    0
    Home Page:
    Hello everyone

    I have problem with following code which I am trying to use to display a chunk of text in the header of a wordpress theme.

    Code:
    function hellishsimplicity_head() {echo '
    <link rel="stylesheet" type="text/css" href="' , bloginfo('template_directory') , '/style' , get_option('hellishsimplicity_colour') , '.css" />';
    $hellishsimplicity_colour = get_option('hellishsimplicity_colour');
    }

    However I would prefer to have an IF statement to control the HTML output.

    Code:
    function hellishsimplicity_head() {
    if ($hellishsimplicity_colour == "blue") {echo "<link rel="stylesheet" type="text/css" href="' , bloginfo('template_directory') , '/styleblue'.css" />";}
    else {echo "<link rel="stylesheet" type="text/css" href="' , bloginfo('template_directory') , '/stylered'.css" />";}
    $hellishsimplicity_colour = get_option('hellishsimplicity_colour');
    }

    But it's not working Does anyone know Where I am wrong?
     

Share This Page