I'm developing Wordpress theme that I wish to be flexible and that i want the admins to have the ability to alter the colors from the theme. This is exactly why I made the decision to make use of style sheet "style.php" that's produced throughout run time using the following code:

    header("Content-type: text/css");
    $options = get_option( "option_group" );

body {
    background-color: <?php echo $options["body-color"]; ?>

/* The rest of the css goes here......... */

and that i incorporated this file within the header section like normal style sheet. However , I recieve "Call to undefined function get_option()" error within this file. I'm wondering how do i have great results. In each and every other file where I call get_option() it really works completely normal. I'd be happy if you're able to produce any suggestion or deal with.

Possess a nice day :)

When the stylesheet is incorporated like a <link> tag in header.php, such as this...

<link href="http://YOURSERVER/wp-content/themes/YOURTHEME/style.php" media="all" type="text/css" rel="stylesheet">

then your style.php script does not get access to WordPress unless of course you load WordPress towards the top of the script. Doing that might be tricky &lifier resource intensive (you would be loading Wordpress two times for each page load.)

Most likely a much better, more effective, method of carrying this out would be to inject the custom styles directly within the <head> from the document such as this:

body {
     background-color: #CCC;

To get this done your theme may use the wp_head action hook...

add_action("wp_head", "my_print_custom_style");
function my_print_custom_style(){
    //look up the option
    //echo out the <style> tag and css

EDIT---- I chose to make this more difficult of computer must be. Since you are coding a style as opposed to a wordpress plugin you are able to output the <style> tag directly in header.php instead of playing around using the wp_head action hook.