Advertisement
Guest User

Untitled

a guest
Nov 26th, 2017
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.63 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. /**
  5.  
  6.  
  7.  * The Template for displaying product archives, including the main shop page which is a post type archive
  8.  
  9.  
  10.  *
  11.  
  12.  
  13.  * @version     2.0.0
  14.  
  15.  
  16.  */
  17.  
  18.  
  19.  
  20.  
  21.  
  22. if ( ! defined( 'ABSPATH' ) ) {
  23.  
  24.  
  25.     exit;
  26.  
  27.  
  28. }
  29.  
  30.  
  31.  
  32.  
  33.  
  34. get_header( 'shop' );
  35.  
  36.  
  37.  
  38.  
  39.  
  40. global $woocommerce_loop, $porto_settings;
  41.  
  42.  
  43.  
  44.  
  45.  
  46. if (!(isset($woocommerce_loop['category-view']) && $woocommerce_loop['category-view'])) {
  47.  
  48.  
  49.     $woocommerce_loop['category-view'] = isset($porto_settings['category-view-mode']) ? $porto_settings['category-view-mode'] : '';
  50.  
  51.  
  52.  
  53.  
  54.  
  55.     $term = get_queried_object();
  56.  
  57.  
  58.     if ($term && isset($term->taxonomy) && isset($term->term_id)) {
  59.  
  60.  
  61.         $cols = get_metadata($term->taxonomy, $term->term_id, 'product_cols', true);
  62.  
  63.  
  64.         if (!$cols)
  65.  
  66.  
  67.             $cols = $porto_settings['product-cols'];
  68.  
  69.  
  70.  
  71.  
  72.  
  73.         $addlinks_pos = get_metadata($term->taxonomy, $term->term_id, 'addlinks_pos', true);
  74.  
  75.  
  76.         if (!$addlinks_pos)
  77.  
  78.  
  79.             $addlinks_pos = $porto_settings['category-addlinks-pos'];
  80.  
  81.  
  82.  
  83.  
  84.  
  85.         $view_mode = get_metadata($term->taxonomy, $term->term_id, 'view_mode', true);
  86.  
  87.  
  88.  
  89.  
  90.  
  91.         $woocommerce_loop['columns'] = $cols;
  92.  
  93.  
  94.         $woocommerce_loop['addlinks_pos'] = $addlinks_pos;
  95.  
  96.  
  97.         if ($view_mode)
  98.  
  99.  
  100.             $woocommerce_loop['category-view'] = $view_mode;
  101.  
  102.  
  103.     }
  104.  
  105.  
  106. }
  107.  
  108.  
  109.  
  110.  
  111.  
  112. if (is_shop()) {
  113.  
  114.  
  115.     $woocommerce_loop['columns'] = $porto_settings['shop-product-cols'];
  116.  
  117.  
  118. }
  119.  
  120.  
  121.  
  122.  
  123.  
  124. $js_wc_prdctfltr = false;
  125.  
  126.  
  127. if (class_exists('WC_Prdctfltr')) {
  128.  
  129.  
  130.     $porto_settings['category-ajax'] = false;
  131.  
  132.  
  133. }
  134.  
  135.  
  136.  
  137.  
  138.  
  139. if ($porto_settings['category-ajax']) {
  140.  
  141.  
  142.     // fix price slider issue
  143.  
  144.  
  145.     $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
  146.  
  147.  
  148.     wp_register_script( 'wc-jquery-ui-touchpunch', WC()->plugin_url() . '/assets/js/jquery-ui-touch-punch/jquery-ui-touch-punch' . $suffix . '.js', array( 'jquery-ui-slider' ), WC_VERSION, true );
  149.  
  150.  
  151.     wp_register_script( 'wc-price-slider', WC()->plugin_url() . '/assets/js/frontend/price-slider' . $suffix . '.js', array( 'jquery-ui-slider', 'wc-jquery-ui-touchpunch' ), WC_VERSION, true );
  152.  
  153.  
  154.     wp_enqueue_script( 'wc-price-slider' );
  155.  
  156.  
  157. }
  158.  
  159.  
  160. ?>
  161.  
  162.  
  163.  
  164.  
  165.  
  166.     <?php
  167.  
  168.  
  169.         /**
  170.  
  171.  
  172.          * woocommerce_before_main_content hook.
  173.  
  174.  
  175.          *
  176.  
  177.  
  178.          * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
  179.  
  180.  
  181.          * @hooked woocommerce_breadcrumb - 20 : removed
  182.  
  183.  
  184.          */
  185.  
  186.  
  187.         do_action( 'woocommerce_before_main_content' );
  188.  
  189.  
  190.     ?>
  191.  
  192.  
  193.  
  194.  
  195.  
  196.         <?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
  197.  
  198.  
  199.  
  200.  
  201.  
  202.             <h2 class="page-title"><?php woocommerce_page_title(); ?></h2>
  203.  
  204.  
  205.  
  206.  
  207.  
  208.         <?php endif; ?>
  209.  
  210.  
  211.  
  212.  
  213.  
  214.         <?php
  215.  
  216.  
  217.             /**
  218.  
  219.  
  220.              * woocommerce_archive_description hook.
  221.  
  222.  
  223.              *
  224.  
  225.  
  226.              * @hooked woocommerce_taxonomy_archive_description - 10
  227.  
  228.  
  229.              * @hooked woocommerce_product_archive_description - 10
  230.  
  231.  
  232.              */
  233.  
  234.  
  235.             do_action( 'woocommerce_archive_description' );
  236.  
  237.  
  238.         ?>
  239.  
  240.  
  241.  
  242.  
  243.  
  244.         <?php if ( have_posts() ) : ?>
  245.  
  246.  
  247.  
  248.  
  249.  
  250.             <div class="shop-loop-before clearfix"<?php if (!is_search() && !woocommerce_products_will_display()) echo ' style="display:none;"' ?>>
  251.  
  252.  
  253.             <?php
  254.  
  255.  
  256.                 /**
  257.  
  258.  
  259.                  * woocommerce_before_shop_loop hook.
  260.  
  261.  
  262.                  *
  263.  
  264.  
  265.                  * @hooked woocommerce_result_count - 20 : removed
  266.  
  267.  
  268.                  * @hooked woocommerce_catalog_ordering - 30
  269.  
  270.  
  271.                  */
  272.  
  273.  
  274.                 do_action( 'woocommerce_before_shop_loop' );
  275.  
  276.  
  277.             ?>
  278.  
  279.  
  280.             </div>
  281.  
  282.  
  283.  
  284.  
  285.  
  286.             <div class="archive-products">
  287.  
  288.  
  289.  
  290.  
  291.  
  292.                 <?php woocommerce_product_loop_start(); ?>
  293.  
  294.  
  295.  
  296.  
  297.  
  298.                    
  299.  
  300.  
  301.  
  302.  
  303.                     <?php $counter = $woocommerce_loop['loop']; ?>
  304.                     <?php while ( have_posts() ) : the_post(); ?>
  305.  
  306.  
  307.  
  308.  
  309.  
  310.                         <?php wc_get_template_part( 'content', 'product' ); ?>
  311.                         <?php $counter++; ?>
  312.                        
  313.  
  314.  
  315.                     <?php endwhile; // end of the loop. ?>
  316.  
  317.                     <?php $woocommerce_loop['loop'] = $counter; ?>
  318.                
  319.                     <?php woocommerce_product_subcategories(); ?>
  320.  
  321.                    
  322.  
  323.                 <?php woocommerce_product_loop_end(); ?>
  324.  
  325.  
  326.  
  327.  
  328.  
  329.             </div>
  330.  
  331.  
  332.  
  333.  
  334.  
  335.             <div class="shop-loop-after clearfix"<?php if (!is_search() && !woocommerce_products_will_display()) echo ' style="display:none;"' ?>>
  336.  
  337.  
  338.             <?php
  339.  
  340.  
  341.                 /**
  342.  
  343.  
  344.                  * woocommerce_after_shop_loop hook.
  345.  
  346.  
  347.                  *
  348.  
  349.  
  350.                  * @hooked woocommerce_pagination - 10
  351.  
  352.  
  353.                  */
  354.  
  355.  
  356.                 do_action( 'woocommerce_after_shop_loop' );
  357.  
  358.  
  359.             ?>
  360.  
  361.  
  362.             </div>
  363.  
  364.  
  365.  
  366.  
  367.  
  368.         <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
  369.  
  370.  
  371.  
  372.  
  373.  
  374.             <div class="shop-loop-before clearfix" style="display:none;"></div>
  375.  
  376.  
  377.  
  378.  
  379.  
  380.             <div class="archive-products">
  381.  
  382.  
  383.                 <?php wc_get_template( 'loop/no-products-found.php' ); ?>
  384.  
  385.  
  386.             </div>
  387.  
  388.  
  389.  
  390.  
  391.  
  392.             <div class="shop-loop-after clearfix" style="display:none;"></div>
  393.  
  394.  
  395.  
  396.  
  397.  
  398.         <?php endif; ?>
  399.  
  400.  
  401.  
  402.  
  403.  
  404.     <?php
  405.  
  406.  
  407.         /**
  408.  
  409.  
  410.          * woocommerce_after_main_content hook.
  411.  
  412.  
  413.          *
  414.  
  415.  
  416.          * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
  417.  
  418.  
  419.          */
  420.  
  421.  
  422.         do_action( 'woocommerce_after_main_content' );
  423.  
  424.  
  425.     ?>
  426.  
  427.  
  428.  
  429.  
  430.  
  431.     <?php
  432.  
  433.  
  434.         /**
  435.  
  436.  
  437.          * woocommerce_sidebar hook.
  438.  
  439.  
  440.          *
  441.  
  442.  
  443.          * @hooked woocommerce_get_sidebar - 10
  444.  
  445.  
  446.          */
  447.  
  448.  
  449.         do_action( 'woocommerce_sidebar' );
  450.  
  451.  
  452.     ?>
  453.  
  454.  
  455.  
  456.  
  457.  
  458. <?php get_footer( 'shop' ); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement