Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

in before: I already searched for this answer her but couldn't find a thing that worked for me.

I have a Lot of Categories and Child Categories. I use them to give a Location, Country, Type of Employment, etc to different posts and to later sort them in my sidebar. My code looks like this.

        $country_filter = array(
                    "show_count" => 0, // no count behind each Category
                    "hide_empty" => 1, // no empty categories
                    "exclude" => "24", // THE ONE to exclude
                    "child_of" => 55, // category ID
                    "title_li" => "");  // leaves the title empty so we can use the headline above

        wp_list_categories($country_filter);

The Thing is: Every post has a Category 55 (it's the Country Category) but can also have 24 - which is a category that should never show up on search, sidebar, etc. this one is only displayed on a specific page.

My question is: How can I remove posts in category 24 from the list? The above snippet doesn't work.

Thanks!

share|improve this question
    
Do you want to exclude the posts of category ID 24 only. right? other categories show their posts. –  Moaz Ateeq Dec 9 '13 at 9:06
    
Also remove the double quotes from the value of exclude. use this 24 instead of "24" –  Moaz Ateeq Dec 9 '13 at 9:09
    
Removing the "" didn't change anything (but you're right they shouldn't be their). I want to remove a post if it has category 24, no matter what else categories it has. –  Kevin Gimbel Dec 9 '13 at 9:13
1  
The problem is: it shows the Child of 55 even if its also in category 24 - and this shouldn't be, because when someone clicks a link (e.g. Spain) the /category/spain page won't show something if the post with category "Spain" also has Category 24. I managed to exclude this category everywhere but only this function totally drives me nuts because it doesn't exclude the posts if they're also inside Category 55. I don't want to tell the Client he has to leave the Country thing empty for his internal Stuff (that ain't no option anyway). Well, thanks for your if I find a way I'll post it here. –  Kevin Gimbel Dec 9 '13 at 9:49
1  
I think I get it, but shouldn't WordPress be able to handle such stuff? I also found that there was a bug but it is said to be removed in 3.7.1 –  Kevin Gimbel Dec 9 '13 at 10:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.