Show tags within a specific category

Hi, I’m trying to show tags within a certain category but can’t seem to find how to do this through providers/consumers. It may need to be done through a query string?

So it will look like:

  • Health (category)
    • food (tag)
    • exercise (tag)

Alternatively I could do this with subcategories but I can’t quite figure this out either :sweat_smile:

Any help would be much appreciated!

Cheers,
David

Hi David,

Thanks for reaching out.
You need to create a Custom Looper to get the Tags related to that or subcategories under it. I would suggest you go through the following article on how to use the Custom Looper and then check the following thread which may help you on this.



Hope it helps.
Thanks

Hi @tristup, thanks for those resources. In the interest of simplicity I want to pull the subcategory name and URL rather than the tags.

I tried getting it to work but with no results so far.

I’ve used this in my functions.php

add_filter(‘cs_looper_custom_subcat’, function($result, $args) {

$term_id= $args['cat'];

$trm=get_term( $term_id, 'category' );

return ['parent_cat'=>$trm->parent];

}, 10, 2);

and this in my custom looper provider:

Can you please advise how I can use this to get the name and url of subcategories from under a parent category.

Cheers,
David

Hi David,

What you are expecting is required little complex customization, which is beyond the scope of Theme Support. I would suggest you hire a developer who can assist you to do the customization or you can avail of our newly launched service called One, where we answer the questions beyond normal theme support.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.