Shortcode for subcategories
-
Hi as the website im building is not yet ready to be indexed or viewed I am going to have to describe clearly the situation.
I have a website using the Avada theme, Woo commerce is installed.
For reasons that I wont go in to here it has been decided to use pages that we have designed and built ourselves rather than the default Woo commerce shop categories pages.So to scale down the situation imagine a shop with 4 categories called:
Cat 1, Cat 2,Cat 3,& Cat 4under each category are a number of subcategories (lets just pretend only 3 in each)
so we now have
Cat 1
|- Subcat 1a, Subcat 1b, Subcat 1c
Cat 2
|- Subcat 2a, Subcat 2b, Subcat 2c
Cat 3
|- Subcat 3a, Subcat 3b, Subcat 3c
Cat 4
|- Subcat 4a, Subcat 4b, Subcat 4c(in reality there will be hundreds of subcategories divided between around 9 top level categories)
I have created a page for each main category, and wish to just display the subcategories that sit within that category on the page using shortcode.
So I tried using this shortcode:
[product_categories category=”cat-1″ limit=”26″ parent=”0″]However for some reason this shows me these categories on the page:
Subcat 1b | Cat 1Not what I need, (I want to be shown: Subcat 1a | Subcat 1b | Subcat 1c )
So I try changing the shortcode to:
[product_categories category=”cat-1″ limit=”26″ parent=”1″]all the categories disappear and none are shown on the page.
So Next I try:
[product_categories category=”subcat1a,subcat1b,subcat1c” limit=”26″]which shows me:
Subcat 1a | Subcat 1b | Subcat 1c | Cat 1Why is it showing me the main category when I didnt ask for it?
Also given the number of subcategories that im going to be using in each category I don’t want to have to type them all out each time.I need a shortcode that will display all the subcategories of any specified category without needing to list them all in the shortcode.
Can anyone please help?
- The topic ‘Shortcode for subcategories’ is closed to new replies.