I have a custom post type called "events". In it, I have a custom meta box called date (which is the day, month and year in which the event will occur).
The problem is that I want to create a new obj WP_QUERY, I can order it by the date I entered in the custom meta box, from more recent, to more distant, and that those that have already occurred, that are not shown.
I know that the order_by exists (I put it down) but among the options I did not find any that refer to a custom meta box.
What could I do in this case?
$paged = ( get_query_var('paged') ) ? get_query_var('paged') :1;
$args = array(
'post_type'=>'eventos',
'posts_per_page' => 8,
'paged' => $paged,
'orderby' => 'title',
'order' => 'DESC'
);
// The Query
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
get_template_part('content-eventos');
}
}