Guest User

Untitled

a guest
Jun 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2. $args = array(
  3. 'posts_per_page' => 7,
  4. 'post_type' => 'product',
  5. 'product_cat' => 'home-featured',
  6. 'meta_key' => 'home_featured_order',
  7. 'orderby' => 'meta_value_num',
  8. 'order' => 'DESC'
  9. );
  10. $query = new WP_Query( $args );
  11. if ( $query->have_posts() ) {
  12. echo '<ul>';
  13. while ( $query->have_posts() ) : $query->the_post();
  14. global $product;
  15. echo '<li>' . the_title() . ' <span>'. $product->get_price_html() .'</span></li>';
  16. endwhile;
  17. echo '</ul>';
  18. wp_reset_postdata();
  19. }
  20. // If you want to query some other custom taxonomy and post type
  21. // ..not a category...then your args
  22. // would look like below
  23. $args = array(
  24. 'post_type' => 'tribe_events',
  25. 'tax_query' => array(
  26. array(
  27. 'taxonomy' => 'tribe_events_cat',
  28. 'field' => 'slug',
  29. 'terms' => 'featured',
  30. ),
  31. ),
  32. );
  33. $query = new WP_Query( $args );
Add Comment
Please, Sign In to add comment