I would like to change the background color of my sidebar depending on which page the user is on. Can someone please tell me how to do this?
This is my sidebar.php code:
<div id="sidebar">
<ul>
<?php if (is_page('consumer-products')) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-consumer-products') ) ?>
<?php } elseif (is_page('small-business-products')) { ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-small-business-products') ) ?>
<?php } else { ?>
<?php } if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(sidebar-main) ) ?>
</ul>
</div>
This is my functions.php code:
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'sidebar-consumer-products',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
'after_title' => '</h2>',
));
register_sidebar(array('name'=>'sidebar-small-business-products',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
'after_title' => '</h2>',
));?>