• Resolved AdrianPB

    (@adrianpb)


    Currently I have a query which works like a charm… the deal is that new year is coming and my code doesn’t support that very much, ugh.

    Here’s the code.

    <?php
    $today = date_i18n( 'm d');
    $agenda_query = new WP_Query(
    	array ( 'post_type' => 'agenda_posts',
    	 'posts_per_page' => '6',
              'offset' => '1',
    	 'orderby' => 'meta_value',
    	 'meta_key' =>  'evento_fecha',
    	 'order' => 'ASC',
    	 	'meta_query' => array(
    		array(
    		'key' => 'evento_fecha',
    		'meta-value' => $value,
    		'value' => $today,
    		'compare' => '>=',
    		'type' => 'CHAR',
    		))
    		)
    	); 
    
    ?>

    Basically it checks for a custom field called evento_fecha which has a date for example 12 16 for December 16, but it only works for posts of the same year, is there a way to implement it to receive the first events for the next year too?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Show upcoming events using wp_query?’ is closed to new replies.