Advertisement
manchumahara

CB Product Page

Nov 29th, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.94 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Product Page
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7. <?php
  8. wp_enqueue_script('jquery');
  9. wp_enqueue_script('jquerymasonry', get_template_directory_uri(). '/js/jquery.masonry.js', array('jquery'));
  10. ?>
  11. <div id="container" class="containerfullwidth one-column one-columnfull">
  12.     <div id="content" role="main">
  13.  
  14.         <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
  15.             <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  16.                  <h1 class="page-title"><?php the_title(); ?></h1>
  17.                 <div class="entry-content">
  18.                         <?php //the_content(); ?>
  19.                 </div><!-- .entry-content -->
  20.                 <?php
  21.                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  22.                     query_posts(array('post_type' => 'product',  'post_status'=>'publish', 'paged' => $paged, 'posts_per_page' => 20));
  23.                 ?>
  24.                         <?php if ( ! have_posts() ) : ?>
  25.                                 <div id="post-0" class="post error404 not-found">
  26.                                         <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
  27.                                         <div class="entry-content">
  28.                                                 <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p>
  29.                                                 <?php get_search_form(); ?>
  30.                                         </div><!-- .entry-content -->
  31.                                 </div><!-- #post-0 -->
  32.                         <?php endif; ?>
  33.                         <div id="productgrid">        
  34.                         <?php while ( have_posts() ) : the_post(); ?>
  35.                                 <div id="post-<?php the_ID(); ?>" <?php post_class('productlisting productlistinggrid'); ?>>
  36.                                     <h2 class="entry-title entry-titlelisting"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  37.                                     <div class="entry-content">
  38.                                             <?php
  39.                                                 $id             = $post->ID;
  40.                                                 if ( has_post_thumbnail() ) :
  41.                                                 echo  get_the_post_thumbnail( $id, array(150, 150 ), array('class' => 'productsimage'));
  42.                                                 endif;
  43.                                                 //the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
  44.                                             <?php the_excerpt( __( 'Continue reading <span class="meta-nav readmore">&rarr;</span>', 'twentyten' ) ); ?>
  45.                                             <div class="clear"></div>
  46.                                             <?php
  47.                                                 $id = $post->ID;
  48.                                                 //$id = 0, $taxonomy, $before = '', $sep = '', $after = ''
  49.                                             ?>
  50.                                             <?php
  51.                                                 /*
  52.                                                 $tags_list = get_the_term_list($id,'product_tag', '', ', ' );
  53.                                                 if ( $tags_list ):
  54.                                             ?>
  55.                                                     <span class="tag-links">
  56.                                                             <?php printf( __( '<span class="%1$s">Tags:</span> %2$s', 'twentyten' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
  57.                                                     </span>                                                    
  58.                                             <?php
  59.                                                 endif;
  60.                                                 */
  61.                                             ?>
  62.                                     </div><!-- .entry-content -->
  63.                                 </div>
  64.                         <?php endwhile; // End the loop. Whew. ?>
  65.                             <div class="clr"></div>
  66.                         </div>   <!-- end productgrid -->  
  67.                         <?php if (  $wp_query->max_num_pages > 1 ) : ?>
  68.                                 <!--div id="nav-below" class="navigation">
  69.                                         <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
  70.                                         <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
  71.                                 </div--><!-- #nav-below -->
  72.                                
  73.                                 <div class="clear"></div>
  74.                                 <?php if(function_exists('wp_paginate')){wp_paginate();} ?>
  75.                                 <div class="clear"></div>                                
  76.                         <?php endif; ?>
  77.                 <?php   wp_reset_query(); //reset query  ?>
  78.             </div><!-- #post-## -->
  79.  
  80.         <?php endwhile; ?>
  81.     </div><!-- #content -->
  82. </div><!-- #container -->
  83. <script type="text/javascript">
  84.     (function( $ ) {
  85.         $(document).ready(function() {
  86.             var $container = $('#productgrid');
  87.             $container.masonry({
  88.                 itemSelector    : '.productlistinggrid',
  89.                 columnWidth     : 440,
  90.                 gutterWidth     : 20
  91.               });
  92.          });
  93.        
  94.     })( jQuery );
  95.    
  96. </script>
  97. <?php //get_sidebar('product'); ?>
  98. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement