• Hello:

    I am working on a site that has a slider. Currently the images are pulling from the category featured. I’ve implemented Events Manager which generates the custom post type event. What I want to do it pull in featured images from both the category featured and the custom post type event. It only seems to work with one and not both. This is what the code looks like.

    <?php $my_query = new WP_Query("post_type=event&category_name=featured&showposts=$featurecount");

    Any suggestions would be greatly appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Couldn’t you use a custom post type template and in that use in_category in your loop?

    Thread Starter Julian

    (@jm300)

    Thanks for your reply! What I want to do is keep the current featured category and use a custom post type as well all in one slider. The problem is the site was done with no custom post types so it’s messy.

    Thread Starter Julian

    (@jm300)

    As an update I think I figured it out. I ended up running the Query twice (one for the post_type and one for the category_name). I also ran into another problem because I only wanted featured events to display. So what I did was expand the event Query by adding the taxonomy that the plugin generates and the term for Featured. Seems to work.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Pulling Both Post Type and Category in WP_Query’ is closed to new replies.