WordPress.org

Ready to get started?Download WordPress

Forums

Query Multiple Taxonomies
show number of posts (5 posts)

  1. Vrefr
    Member
    Posted 4 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
    Member
    Plugin Author

    Posted 4 years ago #

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

  3. Vrefr
    Member
    Posted 3 years ago #

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

  4. Vrefr
    Member
    Posted 3 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:
    wp_list_categories('echo=0&show_count=1&title_li=&taxonomy=districts');
    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
    Member
    Plugin Author

    Posted 3 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

About this Topic