RtThemesSupport

RT18 V1.80 singleproducts 50-50 columns single, post

May 21st, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.20 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" itemscope itemtype="http://schema.org/Product">
  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.             <meta itemprop="name" content="<?php echo get_the_title();?>">
  93.             <meta itemprop="url" content="<?php echo get_the_permalink();?>">
  94.  
  95.         </div>            
  96.        
  97.  
  98.        
  99.         <?php //short description
  100.             echo ! empty( $short_desc ) ? sprintf( '<p itemprop="description">%s</p>', $short_desc ) : "" ;
  101.         ?>
  102.  
  103.         <div class="product_meta">
  104.             <?php
  105.  
  106.                 //SKU
  107.                 echo ! empty( $sku ) ? sprintf( '<span class="sku_wrapper" itemprop="productID"><span class="sku"><b>%s:</b> %s  </span></span> ', __('SKU','rt_theme'), $sku ) : "" ;
  108.  
  109.                 //categories
  110.                 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>' ;
  111.  
  112.             ?>         
  113.         </div>
  114.  
  115.  
  116.     </div>
  117.  
  118.  
  119. </div>
  120.  
  121.  
  122. <div class="space margin-t20 margin-b20"></div><!-- space -->
  123.  
  124. <?php
  125. //get project navigation - for full width page
  126. if( $rt_sidebar_location[0] == "full" ){
  127.     do_action( "get_post_navigation");
  128. }
  129. ?>
  130.  
  131. <div class="row clearfix">
  132.     <div class="box one first">
  133.  
  134.        
  135.         <?php if($tabbed_page):?>
  136.         <div class="tabs_wrap tab-style-three">
  137.             <!-- the tabs -->
  138.             <ul class="tabs clearfix">
  139.                 <?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;?>
  140.                 <?php
  141.                 #
  142.                 #   Free Tabs
  143.                 #  
  144.                 for($i=0; $i<$tab_count+1; $i++){
  145.  
  146.                     $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>': "";
  147.                     $tab_name = get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_title', true);
  148.  
  149.                     if ( ! empty( $tab_name ) && !$password_protected ){
  150.                         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 );
  151.                     }
  152.                 }
  153.                
  154.                 #
  155.                 #   Attached Documents
  156.                 #      
  157.                 if( $rt_attached_documents  && !$password_protected ){
  158.                     echo '<li class="with_icon"><a href="#"><span class="icon-docs"></span>'.__('Documents','rt_theme').'</a></li>';
  159.                 }
  160.  
  161.                 #
  162.                 #   Comments
  163.                 #      
  164.                 if( comments_open() && !$password_protected ){
  165.                     echo '<li class="with_icon"><a href="#"><span class="icon-chat-empty"></span>'.__('Comments','rt_theme').'</a></li>';
  166.                 }              
  167.                 ?>
  168.        
  169.             </ul>
  170.         <?php endif;?>
  171.        
  172.         <?php if($tabbed_page):?><div class="panes"><?php endif;?>
  173.  
  174.         <?php if($content):?>                                  
  175.         <?php
  176.         #
  177.         #   Main content - General Details Tab
  178.         #  
  179.         if($tabbed_page):?><div class="pane"><?php else:?><div class="box one box-shadow margin-b30"><?php endif;?>
  180.             <div>
  181.                 <?php echo $content;?>
  182.             </div>
  183.             <div class="clear"></div>
  184.         </div>
  185.         <?php endif;?>
  186.  
  187.         <?php
  188.         #
  189.         #   Free Tabs' Content
  190.         #  
  191.         for($i=0; $i<$tab_count+1; $i++){
  192.             if ( trim( get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_title', true) )  && !$password_protected ){
  193.                 echo '<div class="pane">';
  194.                 echo (apply_filters('the_content',get_post_meta( $post->ID, RT_COMMON_THEMESLUG.'free_tab_'.$i.'_content', true)));
  195.                 echo '<div class="clear"></div></div>';
  196.             }
  197.         }
  198.         ?>
  199.  
  200.         <?php
  201.         #
  202.         #   Attached Documents
  203.         #          
  204.         if($rt_attached_documents && !$password_protected):?>
  205.                
  206.             <?php if(!$tabbed_page):?><div class="line"></div><?php endif;?>
  207.             <div class="pane">
  208.                 <!-- document icons -->
  209.                 <div class="doc_icons">
  210.                    
  211.                     <?php
  212.  
  213.                     $rt_attached_documents_output = "";
  214.  
  215.                     if(trim($rt_attached_documents)):
  216.                         $rt_attached_documents  = trim(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $rt_attached_documents));  
  217.                         $rt_attached_documents  = explode("\n", $rt_attached_documents);
  218.                     endif;
  219.                    
  220.                     if(is_array($rt_attached_documents)){
  221.                        
  222.                         $rt_attached_documents_output .= '[icon_list font_size="medium_size" icon_style="colored"]';
  223.  
  224.                         foreach($rt_attached_documents as $a_file){
  225.                             if(strrpos($a_file,"|")) {
  226.                                 $fileTarget="";
  227.                                 $a_file = explode("|", $a_file);
  228.                                 $fileTarget = isset( $a_file[2] ) ? trim($a_file[2]) : "";
  229.                                 $fileURL = isset( $a_file[1] ) ? trim($a_file[1]) : "";
  230.                                 $fileName = isset( $a_file[0] ) ? trim($a_file[0]) : "";
  231.                             }else{
  232.                                 $fileURL = trim( $a_file );
  233.                                 $fileName  = "";
  234.                                 $fileTarget = "_self";
  235.                             }
  236.  
  237.                             //the download text
  238.                             if(strpos($fileURL, ".doc")){
  239.                                 $file_text = __('Download Word File','rt_theme');
  240.                             }
  241.  
  242.                             elseif(strpos($fileURL, ".xls")){
  243.                                 $file_text = __('Download Excel File','rt_theme');                             
  244.                             }
  245.  
  246.                             elseif(strpos($fileURL, ".pdf")){
  247.                                 $file_text = __('Download PDF File','rt_theme');
  248.                             }                          
  249.  
  250.                             elseif(strpos($fileURL, ".ppt")){
  251.                                 $file_text = __('Download PowerPoint File','rt_theme');
  252.                             }                          
  253.  
  254.                             else{
  255.                                 $file_text = __('Download File','rt_theme');
  256.                             }
  257.                            
  258.                             //the download link
  259.                             $download_link = ! empty( $fileName ) ? '<a href="'.$fileURL.'" title="'.$file_text.'" target="'.$fileTarget.'">'.$fileName.'</a>' : '<a href="'.$fileURL.'" title="'.$file_text.'">'.$file_text.'</a>';
  260.                        
  261.                             //add to output
  262.                             $rt_attached_documents_output .= '[icon_list_line icon="icon-download"]'.$download_link.'[/icon_list_line]';
  263.                                                                                
  264.                         }
  265.  
  266.                         $rt_attached_documents_output .= "[/icon_list]";
  267.  
  268.  
  269.                         echo do_shortcode( $rt_attached_documents_output );
  270.                     }
  271.                     ?>
  272.  
  273.                 </div>
  274.                 <!-- document icons -->
  275.             </div>
  276.         <?php endif;?>
  277.                
  278.  
  279.         <?php
  280.         #
  281.         #   Comments
  282.         #  
  283.         if( $tabbed_page && comments_open() && !$password_protected ):?>
  284.         <div class="pane">
  285.             <div class='entry commententry'>
  286.                 <?php comments_template(); ?>
  287.             </div>
  288.         </div>
  289.         <?php endif;?>
  290.  
  291.  
  292.                
  293.         <?php if($tabbed_page):?>
  294.         </div>       
  295.         </div><div class="space margin-b20"></div>
  296.         <?php endif;?>
  297.  
  298.     </div>     
  299. </div> 
  300.  
  301. <?php //related products
  302.     if ( is_array( $related_products ) ){
  303.        
  304.         $related_products_item_width = get_option(RT_THEMESLUG."_related_product_layout");
  305.         $related_products_crop = get_option(RT_THEMESLUG."_related_products_crop");
  306.  
  307.         echo do_shortcode (  '[product_carousel id="'.sanitize_text_field($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).'"]' );   
  308.     }
  309.    
  310. ?>
  311. <?php endwhile;?>
  312.  
  313. <?php // comments for pages without tabs
  314. if( !$tabbed_page && !$password_protected && comments_open() ):?>
  315.     <div class="box one">
  316.         <div class='entry commententry'>
  317.             <?php comments_template(); ?>
  318.         </div>
  319.     </div>
  320. <div class="space margin-t10 margin-b20"></div>
  321. <?php endif;?>
  322.  
  323. <?php else: ?>
  324.     <p><?php _e( 'Sorry, no page found.', 'rt_theme'); ?></p>
  325. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment