WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
[resolved] Hide cats who have no posts nor posts in child cats? (13 posts)

  1. dannyjimmy
    Member
    Posted 1 year ago #

    Hi.

    I found it visually cluttered when I'm looking at a category tree full of Category1 (0) (+)
    Category2 (0) (+)
    Category3 (0) (+)
    Category4 (0) (+)
    Category5 (3) (-)

    As a workaround, I:
    1. Added count{{count}} as a class in the li in the mustache template file you provide
    2. Added count0 {display:none !important;} to my theme's CSS file.
    3. Assured that all posts in subcategories were also added to parent category. (Otherwise I would hide empty parent categories of very full subcategories, and the child is hidden along with the parent.)

    This basically works, unless I didn't want to have posts in child cats also be in parent cats. So the feature request would be:

    If neither the category nor any of its children contains any posts, the category is not displayed in the list view.

    http://wordpress.org/extend/plugins/query-multiple-taxonomies/

  2. Jason
    Member
    Posted 1 year ago #

    Weird, mine already hides empty categories. I believe that is a setting you have defined when you created your custom taxonomy.

  3. Unsal Korkmaz
    Member
    Posted 1 year ago #

    +1 on problem.. waiting for proper solution

  4. wxyjp
    Member
    Posted 1 year ago #

    thanks! your idea saved me a lot!

    at the count function in walkers.php,
    i fixed this line (58,59)

    'include_children' => 0,
    'operator' => 'AND'

    to

    'include_children' => true,
    'operator' => 'IN'

    counts of parent terms will include their child terms count.
    it works with me.

  5. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    @dannyjimmy: As Jason said, empty terms are already hidden by default.

    @wxyjp: That seems to work well. Commited to the latest development version (1.6.3-alpha). Thanks for sharing!

  6. dannyjimmy
    Member
    Posted 1 year ago #

    Gotcha. So perhaps I only THOUGHT they were empty, because child-cat-counts weren't included? Either way, seems like this won't be a problem any more starting wit 1.6.3.

    @scribu I have to compliment you on the progress of this plugin; the last update really did wonders and it seems you're still working away to make it better. The work is appreciated.

  7. arudd
    Member
    Posted 1 year ago #

    I'm still having issues with this, not sure what's going on.

    I'm using the List option in the Widget.

    I tried what @wxyjp posted, but didn't seem to resolve anything besides changing quantity for categories, even when it didn't exist.

    I also deactivated all my other plugins with no luck.

    Any ideas?

  8. wxyjp
    Member
    Posted 1 year ago #

    @arudd: I had a similar problem. Are you listing categories and taxonomies in custom post type archive page? If so, you may need to designate your post type. Try this fix to the core.php.

    core.php line 107-111

    $query_vars = array_merge( $query_vars, array(
    	'fields' => 'ids',
    	'qmt_count' => true,
    	'nopaging' => true
    ) );

    to

    $query_vars = array_merge( $query_vars, array(
    	'fields' => 'ids',
    	'qmt_count' => true,
    	'nopaging' => true,
    	'post_type' => get_post_type()
    ) );
  9. arudd
    Member
    Posted 1 year ago #

    All my posts are category based, using the default category.php page, and using get_template_part based on category chosen.

    I haven't made sense of it yet... thank you for your help, and unfortunately, the information above does not help me.

  10. robmuzo
    Member
    Posted 1 year ago #

    Just hide with jquery that's what I did:

    // Remove Empty filter options
    jQuery("#sidebar .term-item a:contains('(0)')").closest('li').remove();
  11. uradvd
    Member
    Posted 1 year ago #

    this fix http://wordpress.org/support/topic/plugin-query-multiple-taxonomies-hide-cats-who-have-no-posts-nor-posts-in-child-cats?replies=10#post-3421903

    not work whith me, wordpress convert '+' to '%2B'
    test request
    product_category=biser-yaponiya&product_size_beads=10-0%2B15-0

  12. demmm
    Member
    Posted 1 year ago #

    +1 on this issue.
    Hide TAGS but not the CATEGORIES.

    I'm Using List win Widget.

  13. RonStrilaeff
    Member
    Posted 11 months ago #

    So what IS the resolution here? I have Version: 1.6.2

    All of the terms and counts show up for me (empty or not). I'm currently using the list mode but the empties show up in all modes.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.