How show post only from after custom date

I have custom post type. In this custom post type I have custom field with date in format: 23/09/2012

How to show only posts, which currently date is before date from these custom field?

Sory for my english.


Solutions Collecting From Web of "How show post only from after custom date"

You can do this using query_posts() or a new WP_Query object. Here’s an example:

query_posts( array(
    'post_type' => 'my_post_type',
    'meta_query' => array(
           'key' => 'my_date_field_key',
           'value' => date( 'd/m/Y' ),
           'compare' => '<',
           'type' => 'DATE'
) );

if ( have_posts() ) : while( have_posts() ) : the_post();

    // your loop code here

endwhile; endif;



If you want to order by date this is a little trickier unless you store the date as a unix timestamp. Then you can orderby meta_value_num as it’s just a number.