How can I only display posts that have a custom field greater than a variable?
-
So I think I keep getting close, but I really suck at these wordpress loops so far.
I have a custom post type (workshops) and that has a custom field (date). I have been able to query the custom type and display it in order of Workshop – Date, but I don’t want it to show dates that have already passed.
I used the “Types” plugin in order to create the custom Types and Fields, so “types_render_field(“date”, array(“output”=>”raw”))” is just that plugin spitting out a Unix Timestamp for the Workshop – Date.How can I tweak this so the query does not show posts that have a “date” value larger than today?
Thank you for your help!
<?php $today = $local_timestamp = get_the_time('U'); $args = array( 'posts_per_page' => 100, 'post_type' => 'workshop-date', 'orderby' => types_render_field("date", array("output"=>"raw")), 'order' => 'ASC' ); query_posts($args); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> (Post Layout here) <?php endwhile; else: ?> <p>There are no dates to display.</p> <?php endif; ?>
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How can I only display posts that have a custom field greater than a variable?’ is closed to new replies.