Skip to content

Instantly share code, notes, and snippets.

@jbotte
Created December 23, 2014 15:24
Show Gist options
  • Save jbotte/86c8d3cc4affef7eec39 to your computer and use it in GitHub Desktop.
Save jbotte/86c8d3cc4affef7eec39 to your computer and use it in GitHub Desktop.
<?php
$start = '2014-12-22';
$end = '2014-12-30';
$args = array(
'posts_per_page' => 5, 'post_type' => 'events',
'meta_key' => 'custom_startdate',
'meta_query' => array(
array(
'key' => 'custom_startdate',
'value' => array($start, $end),
'compare' => 'BETWEEN',
'type' => 'DATE'
)
)
);
$myposts = get_posts( $args );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment