Display two post types ordered by two custom fields
My old code was wrong, this is a good one, as I think: function add_custom_post_type_to_query( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘post_type’, array( ‘post’, ‘facebook_events’, ‘event’ ) ); $query->set( ‘meta_query’, array( ‘relation’ => ‘OR’, array( ‘key’ => ‘event_start_date’, //this is from facebook_events post type ‘value’ => date_i18n(“Y-m-d”), ‘compare’ => ‘>=’, … Read more