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
2010-07-31 12:33:38
Thank you for your excellent answer.I am using the second option and which is working perfectly.
Ajith
2010-08-03 10:02:49