equalmark on "Using Theme Options in CSS"
April 15, 2010 by David Olsen
I am trying to offer some styling options in my theme options page. I have created theme options for the body color and this is retrievable with <?php echo get_option('st_bgcolor'); ?> which works fine when placed in my index.php file for example, but fails in my stylesheet which I have below:
<?php header("Content-type: text/css"); ?>
body {
background-color: #<?php get_option('st_bgcolor'); ?>;
}
I have also included the following in the header.php page to call the new stylesheet:
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/style-options.php" type="text/css" media="screen" />
The stylesheet works and styles the page until I add the <?php echo get_option)’st_bgcolor’); ?> which is where it fails.
Anybody any ideas why? Or perhaps how to fix it? Or even another way of doing this?
Thanks,





Comments
Facebook comments:
Feel free to leave a comment...
and oh, if you want a pic to show with your comment, go get a gravatar!