Forums

WP – Display posts with certain tag only

I’ve been Googling around but can’t seem to find a snippet for my problem.
I have two custom post types – Foods, Promos. Now I have a section on my homepage where I want to show 3 ‘featured’ items either from the Promos or Foods with a tag of ‘featured’.

So basically I just want a snippet to show 3 posts with a tag = ‘featured’ from those two custom post type. I am able to show post with a tag of ‘featured’ but only from Foods or only from Promos.

Seems about right. There might be more efficient ways, but that’s hard to tell without seeing the structure of your code. There’s nothing wrong about this approach though. (I think, I read through it fairly quickly).

Tips

Categories

We have a pretty good* newsletter.

Email Address

CSS-Tricks* is created, written by, and maintained by Chris Coyier and a team of swell people. It is built on WordPress, hosted by Media Temple, and the assets are served by MaxCDN. The fonts are Source Sans Pro and Source Code Pro. It is made possible through sponsorships from products and services we like.