Best practices for a Style/CSS based theme options page?

creating a custom script that writes to the static CSS file is a bad idea!!!
you would need to regenerate the file each time you save any changes.

a better solution would be to save all options in an array of options say for example:

$MyCSS['background_color'] = #009988;
$MyCSS['background_repeat'] = no-repeat;
update_option('theme_settings',$MyCSS);

and that why you only call the “get_option()” function once.

    $MyCSS = get_option('theme_settings');
// and use :
    echo $MyCSS['background_color'];

and make much less calls to the database and use less resources if you are thinking performance wise.

Leave a Comment