New answers tagged wp-list-categories
0
Oudin,
I will answer here the CSS part of your question:
Use this to remove the list bullets:
.ul.product-categories, ul.children{
list-style-type: none;
}
Use this to make only the main categories bold:
li {font-weight:normal} // you need to set the default state first of the list
ul.product-categories > li{font-weight:bold;} //then you can ...
2
Check that you actually have categories before creating the list, and move the lines that echo the <ul> inside the conditional.
$categories = get_the_category();
if (!empty($categories)) {
foreach($categories as $category){
$parent = $category->parent;
if($parent != 0){
echo '<ul style="background:#000">';
...
1
very similar approach to the answer by @AndrettiMilas:
add_filter('wp_list_categories','style_current_cat_single_post');
// filter to add the .current-cat class to categories list in single post
function style_current_cat_single_post($output) {
if( is_single() ) :
global $post;
foreach ( get_the_category($post->ID) as $cat ) {
...
1
I think there has to be a less code intensive answer here so I will leave this question open for a while longer, however, I have found that adding this code to functions.php while still utilizing the code I have provided in my original question is one possible solution.
// Generate the current-cat class when viewing single posts
class singlePostCurrentCat ...
0
From wordpress Codex:
current_category
(integer) Allows you to force the "current-cat" to appear on uses of wp_list_categories that are not on category archive pages. Normally, the current-cat is set only on category archive pages. If you have another use for it, or want to force it to highlight a different category, this overrides what the function thinks ...
0
Use
$(".sidebar li.parent-item").hover(function () {
$(this).find("ul.children").slideToggle("slow");
});
Top 50 recent answers are included