wordpress - Get post type and category -


on frontpage (index.php) display posts of type 'event' category 'main' of type 'post'. how can merge 2 conditions? in current code, can filter 2 post-types not category 'main'.

<?php global $wp_query; $args = array_merge( $wp_query->query, array( 'post_type' => array('post','event') )); query_posts( $args ); ?> 

just change $args this:

<?php $args = array(     'post_type' => array('post','event'),      'tax_query' => array(           'relation' => 'or',        array(          'taxonomy' => 'category',          'terms' => 'main',          'field' => 'slug'        ),        array(          'taxonomy' => 'event_tag', // needs whatever custom taxonomy have declared custom post type.          'terms' => 'main',          'field' => 'slug'        ),     ) ); ?> 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -