• Hey there.

    I’m a theme designer and I’m comfortable with using Theme Options pages in my custom WordPress themes. I’m very familiar with adding options like “Show or Hide Twitter Widget” etc…

    In my upcoming theme, I’m wanting to allow the user to change the color of certain things (background, text, etc…).

    This can only be done by modifying the CSS stylesheet through the built-in Theme Options page.

    I KNOW I’ve seen a tutorial on how to do this a few months back, but I can’t seem to find it now.

    I was hoping someone here can either tell me how I can implement the values inputted in the Theme Options page to the CSS file or point me to a tutorial on the subject.

    Thanks a load for any help ;D

Viewing 3 replies - 1 through 3 (of 3 total)
  • Add to functions.php:

    /* Header customisation */
    define('HEADER_TEXTCOLOR', '505050');
    define('HEADER_IMAGE', '%s/images/header.jpg'); // %s is theme dir uri
    define('HEADER_IMAGE_WIDTH', 700);
    define('HEADER_IMAGE_HEIGHT', 200);
    
    function theme_admin_header_style() {
    	?>
    <style type="text/css">
    /* Add CSS for the Theme Customisation page here
    </style>
    	<?php
    }
    
    function theme_header_style() {
    	?>
    <style type="text/css">
    #header h1 a {background-image:url(<?php header_image(); ?>)}
    #header h1,#header h1 a {color:#<?php header_textcolor();?>;}
    </style>
    	<?php
    }
    if ( function_exists('add_custom_image_header') ) add_custom_image_header('theme_header_style', 'theme_admin_header_style');
    Thread Starter ralph23

    (@ralph23)

    Ooooohhhhh, I see what you did. Instead of modifying the stylesheet, you just added the values to the head of the webpage. Nice.

    Can’t believe I didn’t think of it.

    Thanks.

    Thanks for the script Esmi, is there also a change that I can make 2 custom color things ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Theme Options Stylesheet Question’ is closed to new replies.