tags:

views:

24

answers:

1

Hi, I am using wordpress 3.0. Is there any ways to apply different style class to category navigation. Eg: Consider we have three categories Audio,Video,Upload.Here I need to show Upload category in different style except other two. Thanks...

+1  A: 

You could do it by adding a filter in your theme's functions.php:

function your_list_categories($categories){        
    $categories = preg_replace('Upload', '<span class="upload">Upload</span>', $categories);
    return $categories;
}
add_filter('wp_list_categories', 'your_list_categories');

If you have to do more complex processing, you could use get_categories() method and then loop through and build the output yourself:

function your_list_categories($categories){  

    $categories=  get_categories(); 
    $output = '';

    foreach ($categories as $category) {
        if($category->name == "Upload"){
             $output .= 'Category link code for Upload';
        } else {
             $output .= 'Category link code for all other category links';
        }
    }
    return $output;
}
add_filter('wp_list_categories', 'your_list_categories');
Pat
Thank you for your excellent answer.I am using the second option and which is working perfectly.
Ajith