RtThemesSupport

rttheme18 single products content

Jul 3rd, 2014
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.98 KB | None | 0 0
  1. <?php
  2. #
  3. # rt-theme single product content
  4. #
  5. global $rt_sidebar_location;
  6. ?>
  7.  
  8.     <?php
  9.     if (have_posts()) : while (have_posts()) : the_post();
  10.  
  11.         //get queried object
  12.         $this_product          = get_queried_object();
  13.  
  14.         // featured images
  15.         $rt_gallery_images     = get_post_meta( $post->ID, RT_COMMON_THEMESLUG . "rt_gallery_images", true );
  16.         $rt_gallery_images     = ! empty( $rt_gallery_images ) ? ! is_array( $rt_gallery_images ) ? explode(",", $rt_gallery_images) : $rt_gallery_images : array(); //turn into an array
  17.         $rt_gallery_images     = rt_merge_featured_images( $rt_gallery_images ); //add the wp featured image to the array
  18.  
  19.         //values
  20.         $regular_price         = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'price_regular', true);     
  21.         $sale_price            = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'sale_price', true);
  22.         $sku                   = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'sku', true);
  23.         $rt_attached_documents = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'attached_documents', true);
  24.         $content               = apply_filters('the_content',(get_the_content()));  
  25.         $permalink             = get_permalink();  
  26.         $related_products      = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'related_products[]', true);
  27.         $short_desc            = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'short_description', true);
  28.         $password_protected    = ( post_password_required($post) ) ? true : false ;// Password Protected
  29.  
  30.  
  31.         //free tabs count
  32.         $tab_count=4;
  33.         $tabbed_page = "";
  34.         for($i=0; $i<$tab_count+1; $i++){
  35.             if (trim(get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_title', true))) {
  36.                 $tabbed_page="yes";
  37.             }
  38.         }
  39.     ?>
  40.  
  41.  
  42.  
  43. <div class="row clearfix">
  44.  
  45.         <?php if ( !empty($rt_gallery_images) && is_array($rt_gallery_images) && !$password_protected ): ?>
  46.             <div class="box two first">
  47.                 <!-- product images -->
  48.                 <section class="product_images">
  49.                     <div class="product_images_holder">
  50.  
  51.                         <?php
  52.                             #
  53.                             # call the product slider
  54.                             # @hooked in /rt-framework/functions/theme_functions.php
  55.                             #
  56.  
  57.                             do_action( "rt_product_image_slider", $rt_gallery_images, $this_product->post_name );
  58.                         ?>
  59.  
  60.                     </div>
  61.                 </section><!-- / end section .product_images -->  
  62.             </div>
  63.         <?php endif; ?>
  64.  
  65.  
  66.         <?php echo ! empty( $rt_gallery_images ) ? '<div class="box two last">' : '<div class="box one last">'; ?>
  67.        
  68.         <div class="head_text nomargin">
  69.  
  70.  
  71.             <?php
  72.  
  73.                 #
  74.                 # get info bar (breadcrumb and page title )  
  75.                 # @hooked in /rt-framework/functions/theme_functions.php
  76.                 #
  77.  
  78.                 echo  do_action( "get_info_bar", apply_filters( 'get_info_bar_single_products', array( "called_for" => "inside_content" ) ) );
  79.  
  80.  
  81.                 #
  82.                 # call product price
  83.                 # @hooked in /rt-framework/functions/theme_functions.php
  84.                 #
  85.                 if ( get_option( RT_THEMESLUG."_show_price_in_pages") ){
  86.                     // call product price - hooked in /rt-framework/functions/theme_functions.php
  87.                     do_action( "rt_product_price", array( "regular_price" => $regular_price, "sale_price" => $sale_price) );
  88.                 }
  89.      
  90.             ?>
  91.  
  92.         </div>            
  93.  
  94.        
  95.         <?php //short description
  96.             echo ! empty( $short_desc ) ? sprintf( '<p>%s</p>', $short_desc ) : "" ;
  97.         ?>
  98.  
  99.         <div class="product_meta">
  100.             <?php
  101.  
  102.                 //SKU
  103.                 echo ! empty( $sku ) ? sprintf( '<span class="sku_wrapper" itemprop="productID"><span class="sku"><b>%s:</b> %s  </span></span> ', __('SKU','rt_theme'), $sku ) : "" ;
  104.  
  105.                 //categories
  106.                 echo '<span class="posted_in">' . get_the_term_list( $post->ID, 'product_categories', '<b>'._n('Category','Categories', count( get_the_terms( $post->ID , 'product_categories') ),'rt_theme') .':</b> ', ', ', '' ) . '</span>' ;
  107.  
  108.             ?>         
  109.         </div>
  110.  
  111.  
  112.     </div>
  113.  
  114.  
  115. </div>
  116.  
  117.  
  118. <div class="space margin-t20 margin-b20"></div><!-- space -->
  119.  
  120. <?php
  121. //get project navigation - for full width page
  122. if( $rt_sidebar_location[0] == "full" ){
  123.     do_action( "get_post_navigation");
  124. }
  125. ?>
  126.  
  127. <div class="row clearfix">
  128.     <div class="box one first">
  129.  
  130.        
  131.         <?php if($tabbed_page):?>
  132.         <div class="tabs_wrap tab-style-three">
  133.             <!-- the tabs -->
  134.             <ul class="tabs clearfix">
  135.                 <?php if($content):?><li class="with_icon"><a href="#"><span class="icon-doc-alt"></span><?php _e('General Details','rt_theme');?></a></li><?php endif;?>
  136.                 <?php
  137.                 #
  138.                 #   Free Tabs
  139.                 #  
  140.                 for($i=0; $i<$tab_count+1; $i++){
  141.  
  142.                     $tab_icon = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_icon', true) ? '<span class="'.get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_icon', true).'"></span>': "";
  143.                     $tab_name = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_title', true);
  144.  
  145.                     if ( ! empty( $tab_name ) && !$password_protected ){
  146.                         echo ! empty( $tab_icon ) ? sprintf('<li class="with_icon"><a href="#">%s%s</a></li>', $tab_icon, $tab_name ) : sprintf('<li><a href="#">%s%s</a></li>', $tab_icon, $tab_name );
  147.                     }
  148.                 }
  149.                
  150.                 #
  151.                 #   Attached Documents
  152.                 #      
  153.                 if( $rt_attached_documents  && !$password_protected ){
  154.                     echo '<li class="with_icon"><a href="#"><span class="icon-docs"></span>'.__('Documents','rt_theme').'</a></li>';
  155.                 }
  156.  
  157.                 #
  158.                 #   Comments
  159.                 #      
  160.                 if( comments_open() && !$password_protected ){
  161.                     echo '<li class="with_icon"><a href="#"><span class="icon-chat-empty"></span>'.__('Comments','rt_theme').'</a></li>';
  162.                 }              
  163.                 ?>
  164.        
  165.             </ul>
  166.         <?php endif;?>
  167.        
  168.         <?php if($tabbed_page):?><div class="panes"><?php endif;?>
  169.  
  170.         <?php if($content):?>                                  
  171.         <?php
  172.         #
  173.         #   Main content - General Details Tab
  174.         #  
  175.         if($tabbed_page):?><div class="pane"><?php else:?><div class="box one box-shadow margin-b30"><?php endif;?>
  176.             <div>
  177.                 <?php echo $content;?>
  178.             </div>
  179.             <div class="clear"></div>
  180.         </div>
  181.         <?php endif;?>
  182.  
  183.         <?php
  184.         #
  185.         #   Free Tabs' Content
  186.         #  
  187.         for($i=0; $i<$tab_count+1; $i++){
  188.             if ( trim( get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_title', true) )  && !$password_protected ){
  189.                 echo '<div class="pane">';
  190.                 echo (apply_filters('the_content',get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_content', true)));
  191.                 echo '<div class="clear"></div></div>';
  192.             }
  193.         }
  194.         ?>
  195.  
  196.         <?php
  197.         #
  198.         #   Attached Documents
  199.         #          
  200.         if($rt_attached_documents && !$password_protected):?>
  201.                
  202.             <?php if(!$tabbed_page):?><div class="line"></div><?php endif;?>
  203.             <div class="pane">
  204.                 <!-- document icons -->
  205.                 <div class="doc_icons">
  206.                    
  207.                     <?php
  208.  
  209.                     $rt_attached_documents_output = "";
  210.  
  211.                     if(trim($rt_attached_documents)):
  212.                         $rt_attached_documents  = trim(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $rt_attached_documents));  
  213.                         $rt_attached_documents  = explode("\n", $rt_attached_documents);
  214.                     endif;
  215.                    
  216.                     if(is_array($rt_attached_documents)){
  217.                        
  218.                         $rt_attached_documents_output .= '[icon_list font_size="medium_size" icon_style="colored"]';
  219.  
  220.                         foreach($rt_attached_documents as $a_file){
  221.                             if(strrpos($a_file,"|")) {
  222.                                 $fileTarget="";
  223.                                 $a_file = explode("|", $a_file);
  224.                                 $fileTarget = isset( $a_file[2] ) ? trim($a_file[2]) : "";
  225.                                 $fileURL = isset( $a_file[1] ) ? trim($a_file[1]) : "";
  226.                                 $fileName = isset( $a_file[0] ) ? trim($a_file[0]) : "";
  227.                             }else{
  228.                                 $fileURL = trim( $a_file );
  229.                                 $fileName  = "";
  230.                                 $fileTarget = "_self";
  231.                             }
  232.  
  233.                             //the download text
  234.                             if(strpos($fileURL, ".doc")){
  235.                                 $file_text = __('Download Word File','rt_theme');
  236.                             }
  237.  
  238.                             elseif(strpos($fileURL, ".xls")){
  239.                                 $file_text = __('Download Excel File','rt_theme');                             
  240.                             }
  241.  
  242.                             elseif(strpos($fileURL, ".pdf")){
  243.                                 $file_text = __('Download PDF File','rt_theme');
  244.                             }                          
  245.  
  246.                             elseif(strpos($fileURL, ".ppt")){
  247.                                 $file_text = __('Download PowerPoint File','rt_theme');
  248.                             }                          
  249.  
  250.                             else{
  251.                                 $file_text = __('Download File','rt_theme');
  252.                             }
  253.                            
  254.                             //the download link
  255.                             $download_link = ! empty( $fileName ) ? '<a href="'.$fileURL.'" title="'.$file_text.'" target="'.$fileTarget.'">'.$fileName.'</a>' : '<a href="'.$fileURL.'" title="'.$file_text.'">'.$file_text.'</a>';
  256.                        
  257.                             //add to output
  258.                             $rt_attached_documents_output .= '[icon_list_line icon="icon-download"]'.$download_link.'[/icon_list_line]';
  259.                                                                                
  260.                         }
  261.  
  262.                         $rt_attached_documents_output .= "[/icon_list]";
  263.  
  264.  
  265.                         echo do_shortcode( $rt_attached_documents_output );
  266.                     }
  267.                     ?>
  268.  
  269.                 </div>
  270.                 <!-- document icons -->
  271.             </div>
  272.         <?php endif;?>
  273.                
  274.  
  275.         <?php
  276.         #
  277.         #   Comments
  278.         #  
  279.         if( $tabbed_page && comments_open() && !$password_protected ):?>
  280.         <div class="pane">
  281.             <div class='entry commententry'>
  282.                 <?php comments_template(); ?>
  283.             </div>
  284.         </div>
  285.         <?php endif;?>
  286.  
  287.  
  288.                
  289.         <?php if($tabbed_page):?>
  290.         </div>       
  291.         </div><div class="space margin-b20"></div>
  292.         <?php endif;?>
  293.  
  294.     </div>     
  295. </div> 
  296.  
  297. <?php //related products
  298.     if ( is_array( $related_products ) ){
  299.        
  300.         $related_products_item_width = get_option(RT_THEMESLUG."_related_product_layout");
  301.         $related_products_crop = get_option(RT_THEMESLUG."_related_products_crop");
  302.  
  303.         echo do_shortcode (  '[product_carousel id="'.$this_product->post_name.'-related-products" crop="'.$related_products_crop.'" style="rounded_carousel" heading="'.__("RELATED PRODUCTS",'rt_theme').'" heading_icon="icon-link" item_width="'.$related_products_item_width.'" list_orderby="" list_order="" max_item="" categories="" ids="'.implode(",", $related_products).'"]' );
  304.     }
  305.    
  306. ?>
  307. <?php endwhile;?>
  308.  
  309. <?php // comments for pages without tabs
  310. if( !$tabbed_page && !$password_protected && comments_open() ):?>
  311.     <div class="box one">
  312.         <div class='entry commententry'>
  313.             <?php comments_template(); ?>
  314.         </div>
  315.     </div>
  316. <div class="space margin-t10 margin-b20"></div>
  317. <?php endif;?>
  318.  
  319. <?php else: ?>
  320.     <p><?php _e( 'Sorry, no page found.', 'rt_theme'); ?></p>
  321. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment