Shortcode WHERE for custom taxonomy parent name/slug?
-
Hello! For the most part, Pods does what I need it to do and so far without needing to resort to PHP for it. To that end, I’ve come up against what to me appears to be a simple problem.
I have a custom post type pod, Promo Item, and a custom taxonomy for it, Placement. Placement is hierarchical for convenience, essentially a general collection parent with more specific children locations (e.g. Featured -> Left, Featured -> Bottom, Search Results -> Top, etc). In my pods shortcode for a given page I have in the where
placement.term_id=22 OR placement.parent=22
(22 being the term_id of the given collection parent like Featured) to get the Promo Items assigned to that taxonomy or its direct children. This works but uses a hardcoded term_id of the parent taxonomy in question and only handles first-level children. For simplicity I’m only worrying about first-level children, but in the future I may need to consider multi-level.I know it’s certainly possible in PHP to pods->find the specific taxonomy by name or slug and get its term_id, then later use that term_id in the subsequent find for the specific Promo Items of that taxonomy or its children, basically call pods->find twice. Is it possible to simulate a subselect in the where of a pods shortcode call? Something like
[ pods where="placement.parent=(SELECT term_id FROM placement WHERE slug='featured')" ][ /pods ]
?
- The topic ‘Shortcode WHERE for custom taxonomy parent name/slug?’ is closed to new replies.