How can i get movies there are today in cinema, for example my code display the movies in time that shoud apear 16 January,17 January..., how can i display only the movies in this day.

Ex: today is Wensday 16 January 2013, how can i get only the posts(movies) that shoud apear only today

If i have 2 movies that premiere is on 16 i want to display only that.

For the meta key i use a custom field -'meta_key' => 'premiera_cinema' - with this i select the day.

   <?php // Get today's date in the right format
    $todaysDate = date('Ymd');

<?php $loop = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 3,
'meta_key' => 'premiera_cinema',
'meta_compare' => '>=',
'meta_value' => $todaysDate,
'orderby' => 'meta_value',
'order' => 'ASC'
) ); ?>

<?php while ($loop->have_posts()) : $loop->the_post(); ?>
  • Where are you defining $todaysDate?
    – Alex Lane
    Commented Jan 16, 2013 at 20:58
  • please look now
    – Batman
    Commented Jan 16, 2013 at 21:15
  • What is the date format of premiera_cinema? Show the field configuration... What does this query outputs?
    – brasofilo
    Commented Jan 16, 2013 at 23:19

1 Answer 1


This will compare today's date to the date meta key and select posts with a dates that are greater than or equal:

'meta_compare' => '>='

If you want to match only today's date, change it to just equal:

'meta_compare' => '='

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.