Skip to content

Query not returning anything #11

Description

@vguenichon

I'm trying to get posts with this query:

$all_events = new WP_Query( array(
	'network'			=> true,
	'post_type'			=> 'events',
	'post_status'		=> 'publish',
	'meta_key'	 		=> 'date_debut',
	'orderby' 			=> 'meta_value',
	'order' 			=> $order,
	'posts_per_page'	=> $posts_per_page,
	'meta_query' 		=> array(
	array(
		'key'		=> 'date_debut',
	    'value'     => date('Ymd'),
		'compare'   => $compare == '&lt;' ? '<' : $compare,
		'type'		=> 'DATE',
		),
	)));
$output = '';
if ( $all_events->have_posts() ) {
	$output .= '<div class="events-list '.$el_class.'">';
		while ( $all_events->have_posts() ) : $all_events->the_post();
			ob_start();
		    get_template_part('components/modules/event');
		    $output .= ob_get_clean();
		endwhile;
	$output .= '</div>';
}
return $output;
wp_reset_postdata();

Do you see anything wrong or a mistake using your plugin ?

// EDIT
It seems that it doesn't accept variables as arguments. But I did not get anything from the sites except the main. However I have the same events CPT and some published posts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions