[total_taxonomy]

Shortcode displays total taxonomy terms count on your site.

Attributes

taxonomy
(required) Taxonomy name. E.g.: product_tag.
Default: None
parent
(optional) Parent taxonomy term ID. Enter zero to count top level terms. Enter current to set to the current term ID. Leave empty to count all terms.
Default: None
hide_empty
(optional) Set to yes if you want to skip empty terms.
Default: no

Examples

Example

[total_taxonomy before="Total product categories: " taxonomy="product_cat" on_zero="No product categories."]

Output

No product categories.

16 Responses to “[total_taxonomy]”

  1. Thomas Sensier March 4, 2024 at 12:38 pm #

    Hello,

    i don’t understand how to show total_taxonomy for each parent category whithout all categories in my website. Even with exemple with just texts, i don’t understand how to modify the code. Can you help me please ? For this code:

    [total_taxonomy before="Total product categories: " taxonomy="product_cat" on_zero="No product categories."]

    Thanks ! 🙂

    • Tom March 7, 2024 at 4:36 pm #

      Hi, Thomas,

      Please update the plugin to the latest v1.7.1 (released today) – now you can set the parent attribute to current, e.g.:

      [total_taxonomy before="Total product categories: " taxonomy="product_cat" on_zero="No product categories." parent="current"]

      Please give it a try and let me know what you think.

    • Thomas Sensier March 7, 2024 at 5:10 pm #

      Hello, thank you very much for the update!

      I still don’t understand where I can enter the parent category ID in this code? The place where I put the cide, detect automatically the parent ID category ?

      Thanks for help! 🙂

    • Tom March 8, 2024 at 12:11 pm #

      Hi, Thomas,

      Yes, it will automatically detect the current category and replace the current placeholder with an actual product category ID.

      I’ve tested it by adding the shortcode to a sidebar widget, and it seems to be working fine – the value automatically changes depending on which product category the user is viewing.

    • Thomas Sensier March 8, 2024 at 5:06 pm #

      Hello, it’s weird because it doesn’t detect the category on the page where the code is.

      For example, on my site for “Suzuki Recalls”, it doesn’t detect the category.

      https://carnews-france.fr/rappels-alpine/

    • Tom March 8, 2024 at 6:09 pm #

      Can I log in and take a look (my email is tom@anbinder.me)?

    • Thomas Sensier March 8, 2024 at 8:04 pm #

      Yeah,

      you can register

    • Tom March 11, 2024 at 3:41 pm #

      Hi, Thomas,

      I’ve just registered, but I would need a higher user role to see the admin settings.

    • Thomas Sensier March 11, 2024 at 9:02 pm #

      Hello,

      Hello, okay, you are now admin,

      I test in this page https://carnews-france.fr/rappels-alpine for your shortcode.

    • Tom March 13, 2024 at 9:59 am #

      Hi, Thomas,

      I’ve checked the site, and now I’m not sure if I understood the task correctly in the first place.

      Few notes:

      It looks like you don’t have the product_cat taxonomy on your site (usually this taxonomy comes from the WooCommerce plugin). In your case, I think you need to use the category instead, e.g.:

      [total_taxonomy before="Total categories: " taxonomy="category" on_zero="No categories." parent="current"]

      Also, you are using the shortcode on a WordPress page, so we can’t automatically detect the current category, i.e., we can’t use the current placeholder I added recently. Instead, you would need to set the category ID directly, for example, for the “Rappels : Alpine” category on your site:

      [total_taxonomy before="Total categories: " taxonomy="category" on_zero="No categories." parent="813"]

      * However, it will still display “No categories” as it looks like the “Rappels : Alpine” category doesn’t have any subcategories.

      To use the current placeholder, you have to add the shortcode to the category view, e.g., https://carnews-france.fr/category/rappels-alpine/

      I hope this helps, and please let me know what you think.

    • Thomas Sensier March 13, 2024 at 6:22 pm #

      Hello,

      thank you for your feedback,
      in fact, I’m not looking for a sub-category for Rappels: Alpine, for example. I just wanted to have the total number of items in this main category, because each time I add an item, having previously checked the category of the item in question, I have to manually increment +1, nothing is automatic.

    • Tom March 15, 2024 at 5:12 pm #

      Hi, Thomas,

      Ok, in this case, I think you need the [total_posts] shortcode. However, currently, it doesn’t have an option to select categories. Let me add it to the plugin and get back to you.

    • Thomas Sensier March 17, 2024 at 12:41 am #

      Hello,

      Allright, thanks a lot !

    • Tom March 27, 2024 at 10:28 am #

      Hi, Thomas,

      Sorry for not getting back to you sooner.

      Please update the plugin to the latest v1.7.2 – now you can set category ID in the [total_posts] shortcode with the categories attribute, e.g.:

      [total_posts categories="195"]

      If you are displaying the shortcode on a category archive page, you can use current:

      [total_posts categories="current"]

      Also, you can set multiple categories with a comma-separated list:

      [total_posts categories="195,196,197"]

      Please give it a try and let me know what you think.

    • Thomas Sensier March 27, 2024 at 6:19 pm #

      Hello,

      It works perfectly, thank you very much!!!

    • Tom March 27, 2024 at 6:46 pm #

      Happy to hear it’s solved 🙂 Let me know if you need anything else.

      P.S. If you like the plugin, please consider leaving me a rating.

Leave a Reply