title: Change widget's CSS class names for different category pages in WordPress
body: <p>I want to change the class names of the sidebar widgets on every different category page of WordPress and I figured the best way to do this would be to make a function in functions.php with all the conditions and return the required class name. I then called the function in the list tags of the register_sidebar function.</p>
  
  <pre><code>if (function_exists('register_sidebar')) {
    register_sidebar(array(
     'before_widget' =&gt; '&lt;li class="sidebarModule"&gt;',
     'after_widget' =&gt; '&lt;/li&gt;&lt;!-- end module --&gt;',
     'before_title' =&gt; '&lt;h2 class="moduleTitle "'.set_widget_title_color().'&gt;',
     'after_title' =&gt; '&lt;/h2&gt;',
    ));
  }
  
  
  function set_widget_title_color() {
  
      if(is_category('technology')) {
          $color = "catNavColor1_active";
      } elseif(is_category('gadgets')) {
          $color = "catNavColor2_active";
      } elseif(is_category('social-media')) {
          $color = "catNavColor3_active";
      } elseif(is_category('gaming')) {
          $color = "catNavColor4_active";
      } elseif(is_category('other')) {
          $color = "catNavColor5_active";
      }
  
      return $color;
  }
  </code></pre>
  
  <p>For some reason the above doesn't work. Please Help</p>
  
  <p>Thanks</p>