Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Product Grid Page

By: alchymyth on Nov 16th, 2012  |  syntax: PHP  |  size: 0.77 KB  |  views: 134  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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(); ?>