Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $args = array(
- 'posts_per_page' => 7,
- 'post_type' => 'product',
- 'product_cat' => 'home-featured',
- 'meta_key' => 'home_featured_order',
- 'orderby' => 'meta_value_num',
- 'order' => 'DESC'
- );
- $query = new WP_Query( $args );
- if ( $query->have_posts() ) {
- echo '<ul>';
- while ( $query->have_posts() ) : $query->the_post();
- global $product;
- echo '<li>' . the_title() . ' <span>'. $product->get_price_html() .'</span></li>';
- endwhile;
- echo '</ul>';
- wp_reset_postdata();
- }
- // If you want to query some other custom taxonomy and post type
- // ..not a category...then your args
- // would look like below
- $args = array(
- 'post_type' => 'tribe_events',
- 'tax_query' => array(
- array(
- 'taxonomy' => 'tribe_events_cat',
- 'field' => 'slug',
- 'terms' => 'featured',
- ),
- ),
- );
- $query = new WP_Query( $args );
Add Comment
Please, Sign In to add comment