[wp-hackers] Widget custom CSS

Chris Jean gaarai at gaarai.com
Wed Nov 3 18:28:26 UTC 2010


It seems that John had the same idea before me. Interestingly, we also 
both chose to use blue and red colors as examples. It makes it look like 
I stole the idea. :(

Dang broken threads.

Sorry for trying to steal your thunder John.

Chris Jean (AKA gaarai&  chrisbliss18)
Coder for http://ithemes.com/
http://gaarai.com/
@chrisjean


On 11/03/2010 01:26 PM, Chris Jean wrote:
> Rather than having different stylesheet, why not have a single 
> stylesheet with different each style represented by a specific class? 
> Then all you have to do is output the class for the selected style in 
> the main widget wrapper div or one that is inside the main widget 
> wrapper.
>
> The stylesheet could contain the following:
>
> .blue p { color: #00F; }
> .red p { color: #F00; }
> ...
>
> Then the widget HTML could look like the following:
>
> <?php echo $before_widget; ?>
> <div class="<?php echo $widget['style']; ?>">
> <?php if ( ! empty( $widget['title'] ) ) echo $before_title . 
> $widget['title'] . $after_title; ?>
> ...
>
> Chris Jean (AKA gaarai&  chrisbliss18)
> Coder for http://ithemes.com/
> http://gaarai.com/
> @chrisjean


More information about the wp-hackers mailing list