WordPress.org

Ready to get started?Download WordPress

Forums

Get Number of total Parent Categories for Custom Taxonomy (1 post)

  1. Bartmus
    Member
    Posted 1 year ago #

    I am running an artist feature blog where I do interview artists from different countries and post some travel stuff from different countries.

    I've set up a Custom Taxonomy called "Artist Name". This is only used on Interviews.
    The parent categories are different countries (Germany, US, France, China etc.), the child categories are cities. I use categories on all posts (interviews AND travel stuff).

    I made a statistics page template where I want to show the total number of countries where my interviewes are from.
    In addition I want to show the total number of countries where I've traveled to.

    1) Is it possible to get the total number of all PARENT catagories of posts that use that custom taxonomy?

    2) Is it possible to get the total number of all PARENT catagories of posts that do NOT use that custom taxonomy (e.g. when Artist Name is blank)?

    I already tried to use some code snippets I found including count(get_categories('parent=0&hide_empty=0') but I am not that good in PHP to figure it out.

Topic Closed

This topic has been closed to new replies.

About this Topic