Created
December 30, 2014 22:58
-
-
Save rayflores/04d5d22f263b395ea68b to your computer and use it in GitHub Desktop.
I wanted to show posts from limited deals plugin. Order it by the deal with the most time to expiration, and then ensure that the post contained a limited deal (via checkbox), and show the latest post from there... here is what I ended up with :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'product', | |
'meta_key' => '_limited_dates_to', | |
'orderby' => 'meta_value', | |
'order' => 'DESC', | |
'meta_query' => array( | |
array( | |
'key' => '_limited', | |
'value' => 'yes', | |
'compare' => '=', | |
), | |
), | |
'posts_per_page' => 1 | |
); | |
$limited_query = new WP_Query( $args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment