RtThemesSupport

rt-13 product loop

Aug 18th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.19 KB | None | 0 0
  1. <?php
  2. /*
  3. * rt-theme product loop
  4. */
  5.  
  6. global $args,$related_products,$product_page_content;
  7. query_posts($args);
  8.  
  9. $box_counter = 0;
  10. if ( have_posts() ) : while ( have_posts() ) : the_post();
  11.  
  12. //get page and post counts
  13. $page_count=get_page_count();
  14.  
  15. ?>
  16.        
  17.     <!-- box -->
  18.     <?php if (fmod($box_counter,3)==0) :?>
  19.         <div class="box products three first">
  20.     <?php elseif (fmod($box_counter,3)==2) :?>
  21.         <div class="box three products last">        
  22.     <?php else:?>
  23.         <div class="box three products">
  24.     <?php endif;?>
  25.    
  26.         <!-- product image -->
  27.         <?php if(get_post_meta($post->ID, 'rt_product_image_url', true)):?>
  28.         <div class="product_image">
  29.         <span class="border alignleft">
  30.             <a href="<?php echo get_permalink() ?>" title="<?php the_title(); ?>" class="imgeffect plus">
  31.           <?php
  32.           // Resize Portfolio Image
  33.  
  34.           $imgURL = find_image_org_path(get_post_meta($post->ID, 'rt_product_image_url', true));
  35.           $photo_title="";
  36.           list($imgURL,$photo_title) = split('[|]', $imgURL);        
  37.           $crop     = true;
  38.           if($imgURL) $image_thumb = @vt_resize( '', $imgURL, 188, 0, ''.$crop.'' );
  39.           ?>
  40.             <img src="<?php echo $image_thumb["url"];?>" alt="<?php the_title(); ?>" />                  
  41.             </a>
  42.         </span><div class="clear"></div>
  43.         </div>
  44.         <?php endif;?>
  45.        
  46.         <!-- product title-->
  47.         <h6><a href="<?php echo get_permalink() ?>" title=""><?php the_title(); ?></a></h6>
  48.        
  49.         <?php if(get_post_meta($post->ID, 'rt_short_description', true)):?>
  50.         <p>
  51.         <!-- text-->
  52.         <?php echo get_post_meta($post->ID, 'rt_short_description', true);?>
  53.         </p>
  54.         <?php endif;?>
  55.        
  56.     </div>
  57.     <!-- /box -->
  58.  
  59. <?php
  60.       $box_counter++;
  61.       if (fmod($box_counter,3)==0 || $box_counter==$page_count['post_count']){
  62.           echo "<div class=\"line\"></div>";
  63.       }
  64. ?>
  65.  
  66. <?php endwhile?>
  67. <?php
  68. //show pagination if page count bigger then 1
  69. if ($page_count['page_count']>1):
  70. ?>
  71.     <!-- paging-->
  72.     <ul class="paging blog"><?php get_pagination(); ?></ul>
  73.     <!-- / paging-->
  74. <?php endif;?> 
  75. <?php endif; wp_reset_query();?>
Advertisement
Add Comment
Please, Sign In to add comment