This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Using Newly Added Theme Options

  • Creator
  • #7515

    Hi there

    I am quite new to customising WP themes, so this may be a stupid question:

    I would like to add an option to WPJumpstart with the options api to change the header color. I will be using the streched child theme. I understand how to add the option to the options page from the help files, but I don’t see how to actually use it. I can make this change manually in the child theme css file.

    Could you please tell me how to actually use this value to change the theme header colorafter I have added the option to the options page

    Thank you very much

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #7517
    Jason Bobich


    So, after you’ve added an option, you’d utilize it within your site with the themeblvd_get_option function.

    How you want to actually take an option and apply it is really up to you. Just in general, there’s really no way to easily incorporate a PHP element pulled from the database into a stylesheet. A more common approach would be to output some sort of styles in the <head> of your site.

    A basic example of just hooking styles to wp_head from your Child theme’s functions.php might look something like this:

    function my_styles(){
    	$my_color = themeblvd_get_option('my_custom_option');
    	#top { background-color: <?php echo #my_color; ?> }
    add_action('wp_head', 'my_styles');

    This will get the job done. But later on if you want to get more advanced, technically it’s better if your styles (whether they’re in a stylesheet or not) fall in with WordPress’s CSS enqueue system. You can accomplish that by utilizing wp_add_inline_style to attach a function to another stylesheet you’re enqueing.


    Thank you very much Jason.

    Wow!! Excellent Support!!


    Hi Jason

    I apologise, but I have one more question:

    I what file must I add the new theme options code? The child theme does not have an options.php file. Must I also add it to the child theme’s functions.php file? Or must I add it to the parent theme’s options.php file?

    Thank you very much

    Jason Bobich

    This will all go in your functions.php — In any WordPress theme, all of your PHP functionality that isn’t directly being outputted in a standard template file (i.e. header.php, footer.php, etc) goes in the functions.php.

    As you accumulate more functionality, you can make things more organized with different files, but it all stems from functions.php. For example, take the options of the Parent Jump Start theme. You’ve got a functions.php -> which includes a themeblvd.php -> which includes theme-functions.php -> which includes an options.php file.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.