Advertisement
BackuPs-nl

rt9 product pagination

Jun 8th, 2016
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.78 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Product List
  4. */
  5. $product_temp="true";
  6. get_header();
  7. $this_is_product=true;
  8. $box_counter="";
  9. ?>
  10. <?php
  11. if (get_option('rttheme_style')){
  12.     $which_theme=get_option('rttheme_style');
  13. }else{
  14.     $which_theme="1";      
  15. }
  16. ?>
  17.  
  18. <?php
  19.     //call sub page header
  20.     get_template_part( 'sub_page_header', 'sub_page_header_file' );
  21. ?>
  22.  
  23. <div class="content_con2">
  24.  
  25. <!-- left side content -->
  26. <div class="content productlist">
  27.  
  28.         <!-- box -->
  29.         <div class="box single">
  30.             <?php
  31.             if (is_category()) {
  32.                 $page_title=single_cat_title("", false);
  33.             }else{
  34.                 $page_title=single_post_title("", false);
  35.             }
  36.             ?>
  37.            
  38.            
  39.            
  40.             <!-- box title-->
  41.             <h3><?php echo $page_title; ?></h3>
  42.  
  43.             <?php      
  44.             if(!$cat){
  45.             if (have_posts()) : while (have_posts()) : the_post();$current_post=$post->ID;
  46.            
  47.             ?>
  48.             <?php the_content(); ?>
  49.            
  50.             <?php endwhile; endif; }?>
  51.              
  52.    
  53.         </div>
  54.         <!-- /box -->
  55.              
  56.         <?php if ($cat || !get_option("rttheme_products_first_page_hide")):?>
  57.  
  58.         <?php
  59.         $more = 0;
  60.  
  61.         //paging
  62.         if (get_query_var('paged') ) {$paged = get_query_var('paged');} elseif ( get_query_var('page') ) {$paged = get_query_var('page');} else {$paged = 1;}      
  63.          
  64.  
  65.         if(is_category()){//category
  66.             $query_string='cat='.get_query_var('cat').'&paged='.$paged.'&posts_per_page='.get_option("rttheme_product_list_pager").'&post_status=publish&orderby=date&order=DESC';
  67.         }elseif(get_option('rttheme_portf_start_cat')){//start page with start category
  68.             $query_string='cat='.get_option('rttheme_product_start_cat').'&paged='.$paged.'&posts_per_page='.get_option("rttheme_product_list_pager").'&post_status=publish&orderby=date&order=DESC';
  69.         }else{//start page with all categories
  70.            
  71.             $query_string='cat='.get_option('rttheme_product_list_ex_cat[]').'&paged='.$paged.'&posts_per_page='.get_option("rttheme_product_list_pager").'&post_status=publish&orderby=date&order=DESC';
  72.         }
  73.         query_posts($query_string);
  74.         ?>
  75.  
  76.             <div class="clear"></div>
  77.             <!-- paging-->
  78.             <div class="paging portfolio" style="margin-bottom:20px;">
  79.                 <ul>
  80.                     <?php get_pagination(); ?>
  81.                 </ul>
  82.             </div>
  83.             <!-- / paging-->
  84.             <?php if (have_posts()) : while (have_posts()) : the_post();?>
  85.  
  86.                 <!-- box -->
  87.                     <div class="box product">
  88.                           <img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $which_theme;?>/small_box_top.jpg" alt="" class="p_image_top" />
  89.                         <div class="imgarea product_image preload">
  90.        
  91.                                 <!-- product image -->
  92.        
  93.                                 <?php if(get_post_meta($post->ID, 'rt_product_image_url', true)):
  94.                                     // Resize Image
  95.                                     $imgURL = find_image_org_path(get_post_meta($post->ID, 'rt_product_image_url', true));
  96.                                     $crop   = true;
  97.                                     if($imgURL) $image_thumb = @vt_resize( '', $imgURL, 160, 0, ''.$crop.'' ); 
  98.                                 ?>
  99.                                          <a href="<?php echo get_permalink() ?>" title="<?php the_title(); ?>">
  100.                                             <img src="<?php echo $image_thumb["url"];?>" alt="<?php the_title(); ?>" class="image product_image preload" />
  101.                                          </a>
  102.                                 <?php endif;?>
  103.        
  104.                                 <!-- / product image -->
  105.                                        
  106.                         </div>
  107.                         <div class="textarea">
  108.                             <!-- box title-->
  109.                             <h5><a href="<?php echo get_permalink() ?>" title=""><?php the_title(); ?></a></h5>
  110.                                 <!-- text-->
  111.                                 <?php echo get_post_meta($post->ID, 'rt_short_description', true);?>
  112.                                
  113.                                 <?php if(get_post_meta($post->ID, 'rt_product_price', true)):?>
  114.                                 <br />
  115.                                 <span class="price"><?php echo get_post_meta($post->ID, 'rt_product_price', true);?></span>
  116.                                 <?php endif;?>
  117.                         </div>
  118.                         <img src="<?php echo get_template_directory_uri(); ?>/images/<?php echo $which_theme;?>/small_box_bottom.jpg" alt=""  class="p_image_bottom" />
  119.                     </div>
  120.                 <!-- /box -->
  121.  
  122.             <?php
  123.                 $box_counter++;
  124.                 if ($box_counter==3){
  125.                     echo "<div class=\"clear\"></div>";
  126.                     $box_counter=0;
  127.                 }
  128.             ?>
  129.  
  130.             <?php endwhile; ?>
  131.             <!-- /product boxes -->
  132.            
  133.  
  134.             <div class="clear"></div>
  135.  
  136.  
  137.  
  138.             <?php else: ?>
  139.                 <p><?php _e('No product found.','rt_theme');?></p>
  140.             <?php endif; ?>
  141.        
  142.         <?php endif;?> 
  143.  </div>
  144. <!-- / left side content -->
  145.  
  146.  
  147. <!-- side bar -->
  148. <div class="sidebar"><div class="sidebars1"><div class="sidebars2">
  149.        
  150.         <?php
  151.             include(get_template_directory()."/sidebar.php");      
  152.             if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar For Products'));
  153.             if (function_exists('dynamic_sidebar') && dynamic_sidebar('Common Sidebar'));
  154.            
  155.             if($cat){          
  156.                 rt_ud_sidebars('cat',$cat);
  157.             }else{
  158.                 rt_ud_sidebars('page',$current_post);              
  159.             }
  160.            
  161.         ?>
  162.  
  163. </div></div></div>
  164. <div class="clear"></div>
  165. <!-- / side bar -->
  166. </div>
  167. <?php get_footer();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement