Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mjinayan80/567e47ffe89b59a3872aa5dd8333a9ca to your computer and use it in GitHub Desktop.
Save mjinayan80/567e47ffe89b59a3872aa5dd8333a9ca to your computer and use it in GitHub Desktop.
<?php
$sdtime = DateTime::createFromFormat("d F, Y", '1 February, 2018');
$edtime = DateTime::createFromFormat("d F, Y", '30 February, 2018');
$startday = $sdtime->getTimestamp();
$endday = $edtime->getTimestamp();
$q = new WP_Query(
array(
'posts_per_page' => $count,
'post_type' => 'fixture-item',
'meta_key' => 'date',
'orderby' => 'meta_value',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'date',
'value' => array( $startday, $endday ),
'compare' => 'BETWEEN',
),
),
)
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment