Advertisement
Guest User

WP query

a guest
Jun 12th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Full-width Page Template, No Sidebar
  4. *
  5. * Description: Twenty Twelve loves the no-sidebar look as much as
  6. * you do. Use this page template to remove the sidebar from any page.
  7. *
  8. * Tip: to remove the sidebar from all posts and pages simply remove
  9. * any active widgets from the Main Sidebar area, and the sidebar will
  10. * disappear everywhere.
  11. *
  12. * @package WordPress
  13. * @subpackage Twenty_Twelve
  14. * @since Twenty Twelve 1.0
  15. */
  16.  
  17. get_header(); ?>
  18.  
  19.  
  20. <div id="primary" class="site-content">
  21. <div id="content" role="main">
  22.  
  23. <?php
  24. $args = array( 'post_type' => 'product', 'posts_per_page' => 10, 'category__and' => array( 20, 61, 74, 28 ), 'orderby' => 'date' );
  25. $loop = new WP_Query( $args );
  26.  
  27. while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
  28.  
  29. <?php echo do_shortcode('[product id="'.$loop->post->ID.'"]') ?>
  30.  
  31. <?php endwhile; ?>
  32. <?php wp_reset_query(); ?>
  33.  
  34.  
  35. </div><!-- #content -->
  36. </div><!-- #primary -->
  37.  
  38. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement