WordPress.org

Ready to get started?Download WordPress

Forums

WP Query Category or Custom post (5 posts)

  1. dadvan
    Member
    Posted 1 year ago #

    Hello,

    I am trying to figure out how to return posts from WP query that are in one of 3 categories OR a particular post type. Here is the code I am starting with:

    <?php
    	global $post;
    	$querycs_args = array(
    	  'posts_per_page' => 3,
    	  'category_name' => 'case-studies,videos,white-papers',
              'post_type' => 'event'
    	);
    
            $querycs = new WP_Query( $querycs_args );
    ?>
    
    <?php
    if( $querycs->have_posts() ) : while( $querycs->have_posts() ) : $querycs->the_post();
    ?>
  2. esmi
    Forum Moderator
    Posted 1 year ago #

    I'm not sure what the problem is. Did you review http://codex.wordpress.org/Function_Reference/WP_Query

  3. dadvan
    Member
    Posted 1 year ago #

    Works fine as is if I want it to be in one of the categories and be a particular post type, I need it look for only one criteria to be met.

  4. dadvan
    Member
    Posted 1 year ago #

    So a post that is in one of the defined categories or an event post type

  5. dadvan
    Member
    Posted 1 year ago #

    anybody?

Topic Closed

This topic has been closed to new replies.

About this Topic