Using theme options to change link colours

To make theme options for css, you include the css in the header. on wp_head…

For instance, I have set up various options in my admin menu in an array.

        'name' => __( 'Custom CSS', 'voodoo_lion' ),   
    "desc" => __( 'Want to add any custom CSS code? Put in here, and the rest is taken care of. This overrides any other stylesheets. eg: a.button{color:green}', 'voodoo_lion' ),   
    "id" => $shortname."_custom_css",   
    "type" => "textarea",   
    "std" => ""
),

is the option for entering custom css. Then I add that action to wp_head

add_action( 'wp_head', 'voodoo_inline_css', 100000 );

and define voodoo_inline_css. I have a variety of things in the voodoo_inline_css function, but one of them is:

if( get_theme_option( 'custom_css' ) ) 
    theme_option( 'custom_css' );

Hopefully that helped a little… you can also just call the option directly in header.php

<style type="text/css" media="screen">
   .content a:link {
        color: <?php echo get_theme_option(' link-color '); ?>;
    }
</style>

Either way, you need to output the css into the header rather than trying to get it into a stylesheet.

Just a note here, this theme options code is copy/pasted from my theme as an example so you can see bits of code and compare. Since you followed your own tutorial, your options will be set up somewhat differently. I wanted to show that you would output your option to the header (using either wp_head or directly) to have the css take effect.

Leave a Comment