View Single Post
  #1 (permalink)  
Old 02-28-2008, 01:36 AM
ryanhellyer's Avatar
ryanhellyer ryanhellyer is offline
Super Moderator
 
Join Date: Dec 2007
Posts: 708
Default PHP in WordPress theme

Okay, I have the following code which I'm trying to use to display a chunk of text in the header of a WordPress theme.

PHP 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');

It currently outputs either red or blue to change the style sheet used in the way shown. However I would prefer to have an IF statement to control the HTML output.

So I tried the following code:

PHP 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 what I'm doing wrong?
Reply With Quote