I'm using GWcode Categories and I'm trying to figure out how to show, for example, 3 specific categories AND said categories children as well. I know of the show param though, it appears this needs to include the parent category IDs AND their children IDs to have both parents and children show up. Using show="1|2|3" I only get the 3 parent cats in other words.

That of course sucks because anytime a client adds a new child cat we have to update the show param IDs again.

It's almost like we are missing a show_include_children="yes" in the case of the show param. The next param (excl_cat_id) has something similar in fact.

I know there is the excl_cat_id="" along with excl_cat_id_children="yes" params which would work though, that would mean any time a new parent category is added I'd have to go in and excluded that one as well and it's children when added too. The opposite of show in other words though, the same issue.

I know about the cat_id param though, this is only for one category and it's children and of course is only half of what I need. I tried piping here without success.

What about using conditionals or Switchee? Something along the lines of this: {if parent_id == "1|2|3"} my vars {/if} this would probably work though, seems like there should be a way to do this with out having to loop through 1000 categories just to check for 3.

With all that said, am I missing something, is there not a way to show 3 categories AND their children based on the 3 parent IDs?



1 Answer 1


I was just doing something with GW Categories that involved showing child categories. In the end I ditched it in favour of using the query module.

You could run a query something like

select * from exp_categories where parent_id='CURRENT CATEGORY ID'

and pass it your category IDs as required

  • Hmm, I didn't think of using a query as I thought this would be possible as is. I still think I want to use GW Cats but, maybe I could run a similar query to feed the show param with the parent IDs and their children too ala Stash.
    – Natetronn
    May 21, 2013 at 21:37
  • Okay I was able to get the proper query and stash setup to grab the IDs to feed to show though, I'm not sure show param honors the parent child relationship. I wasn't able to get it working properly anyway so, that's my assumption at this point.
    – Natetronn
    May 21, 2013 at 22:21
  • Maybe I'm hitting a parse issue here actually now that I think of it. I was able to get the query and stash:set setup correctly though, not sure I'm able to pass the piped IDs properly or not. I've tried a bunch of stuff including various stash embeds, stash embed vars, process (end,inline,start) etc. without success.
    – Natetronn
    May 21, 2013 at 22:55
  • I had to pass pipe delimited lists to stash recently, had regex the list as I was using stashs match param, can you post what you have this far ? May 22, 2013 at 1:30
  • I'm not sure I'd have bothered with Stash. Would the performance hit of doing 3 selects be that horrible? I'd probably modify the query to get specific columns though rather than using *
    – foamcow
    May 22, 2013 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.