Query Multiple Taxonomies
show number of posts (5 posts)

  1. Vrefr
    Posted 6 years ago #

    Hello Scribu!
    Thanks fo trh perfect plugin!
    Tried to search for an answer, but in vain, so desided to ask here.
    I would like to show a number of posts im () just after or before + sign.
    E.g. Category name (+) (7) or Tag name (+) (12)
    In ordinary category widget this option can be choosen in the admin part.
    Is it possible to do within your Query Multiple Taxonomies plugin widget?

    Thank you in advance for your answer!

  2. scribu
    Plugin Author

    Posted 6 years ago #

    It's possible, but with a lot of extra SQL queries.

  3. Vrefr
    Posted 6 years ago #

    Don't you plan to add this option to your plugin updates?

  4. Vrefr
    Posted 6 years ago #

    I suppose it can be done using this code but for each category:

    foreach (get_categories(array('hide_empty'=>false)) as $category)
    			$getcatnum = $category->count;

    question is how to adopt it for custom taxonomies?
    I was trying to use this:
    and this:

    foreach (get_categories('taxonomy=districts') as $category)
    $getcatname = $category->name;
    echo ''. $category->count .' '.$getcatname.' get cat style';

    "districst" - are one of the taxonomy
    how to use this withing the plugin?
    And how to be with tags in same way?

  5. scribu
    Plugin Author

    Posted 6 years ago #

    You can use get_terms() instead of get_categories().

    However, that count represents the total number of associated posts, not the number you would find if you filter by that term, and others.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Query Multiple Taxonomies
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic