I have 2 Custom Post Types: “Packages” and “Services.” A “service” would be “weddings” for example. The other post type, “Packages” would have the different packages my business offers across the different services. That means there are certain packages that are specific only to that specific service. So if I have 10 packages, 4 of them are for “weddings.” The way I’m associating the 2 different post types is by using a common taxonomy between them. The “Weddings” service uses a term “weddings” and so do the packages that are specific to the term “weddings.”
What I’m therefore trying to do is construct a query that only shows “packages” that have the term “weddings” on the same page as the Service that also uses the taxonomy term “weddings.”
I haven’t been able to get the query loop correct in order to do that. I either get all the packages on the wedding page or none at all
I was able to construct this query using Jet Engine’s query builder, and am trying to “port” it to Bricks Query Loop instead, but somewhere along the line I don’t have the query correct.
The Taxonomy type is “Package Types” and is shared between the 2 CPTs.
Can anyone help me get the query setup in such a way that “Weddings” only shows packages that are specific to weddings? This way my “services” template will always load the appropriate packages for the service at which you’re looking. I feel like I am close! Obviously I can just use the JetEngine Query Builder, which at this particular moment seems more powerful and is doing what i would like, but I want to learn the Query Loop so I can do as much in Bricks as possible.
Of course I’m open to hearing of other ways to achieve this as well!
You can see in Jet Engine query builder, there is the option to use the “current terms” to grab posts from the CPT. That seems to be the part of Query Loop that I can’t re-create. Just adding more context! Take note that this is a query I built on a different site but does the same thing, so the name of the Taxonomy isn’t the same as what I referenced in my original post.
I don’t see that in the Query loop, but I could certainly be missing it. Also, didn’t occur to me to include 2 post types in the query, so appreciate that tip. I’m sure I don’t have this configured correctly trying to interpret the code above and port it to the Query Loop. From where did you generate that code? Appreciate the effort here, but can’t quite transfer what I’m seeing the the loop.
That’s a nifty generator you created! I will have a look at that for sure. I don’t have a toggle switch for “Query editor PHP” like you do. Just “Type” and then “Post Type” right underneath it. Is that a Bricks setting I need to switch on?
Thank you, I will have a look. I may stick with the JetEngine query builder for the moment while I read the documentation for Query editor. Appreciate the help!