Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


WP _query conditional statement with custom post

I would like someone help if it's possible to write conditional statement with multiple WP Queries.

Here is what I want to do.

I have custom posts 1, each post has own parameters like title, picture, description.

I have custom posts 2, each of them has a tag.

I need to display in every custom post 1 as many as exist custom posts 2 which tags are equal to the custom post 1 title.

Is it possible?

Oxanaox, have you tried writing that statement?

1 Answer

Kevin Korte
Kevin Korte
28,148 Points

Sure it's possible. You're going to have to get the tags of custom post 2, and show any that match the title in custom post 1. WP has a lot of functions for working with tags and custom posts.