Advertisement
alchymyth

Product Grid Page

Nov 16th, 2012
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Template Name: Product Grid Page
  4.  *
  5.  */
  6.  
  7. get_header(); ?>
  8.  
  9.     <div id="primary" class="site-content">
  10.         <div id="content" role="main">
  11.  
  12.             <?php $args = array(
  13.                 'posts_per_page' => 6,
  14.                 'category_name' => 'products',
  15.                 'paged' => get_query_var('paged')
  16.                 );
  17.                 $product_posts = new WP_Query( $args );
  18.             if( $product_posts->have_posts() ) :
  19.             while ( $product_posts->have_posts() ) : $product_posts->the_post(); ?>
  20.            
  21.             <div class="product grid">
  22.                 <?php the_post_thumbnail('thumbnail');//add here what you want to output per post/product// ?>
  23.                
  24.             </div><!-- .product -->
  25.            
  26.             <?php endwhile; // end of the loop.
  27.             endif; wp_reset_postdata(); ?>
  28.  
  29.         </div><!-- #content -->
  30.     </div><!-- #primary -->
  31.  
  32. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement