Created
April 21, 2014 07:11
-
-
Save goliver79/11134699 to your computer and use it in GitHub Desktop.
[WOOCOMMERCE] Get only products with price
This file contains hidden or 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 | |
| /* | |
| * @goliver79 | |
| * get only products with price | |
| * ordered by date DESC (newer first) | |
| */ | |
| $posts = new WP_Query ( array ( | |
| 'post_type' => 'product', | |
| 'order' => 'DESC', | |
| 'orderby' => 'date', | |
| 'meta_query' => array( | |
| array( | |
| 'key' => '_price', | |
| 'value' => 0, | |
| 'compare' => '>' | |
| ) | |
| ) | |
| ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment