Advertisement
lampuah

archive-product.php

Apr 25th, 2024
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.26 KB | Source Code | 0 0
  1. <?php
  2.  
  3. /**
  4.  * The Template for displaying product archives, including the main shop page which is a post type archive.
  5.  *
  6.  * Override this template by copying it to yourtheme/woocommerce/archive-product.php
  7.  *
  8.  
  9.  * @author      WooThemes
  10.  * @package     WooCommerce/Templates
  11.  * @version     10.0.0
  12.  */
  13.  
  14. if (!defined('ABSPATH')) exit; // Exit if accessed directly
  15.  
  16. get_header('shop');
  17.  
  18. $product_query_args = array(
  19.   's'              => get_search_query(),
  20.   'post_types'      => 'product',
  21.   'posts_per_page' => 30,
  22.   'relevanssi'     => true,
  23.   'orderby' => 'date',
  24.   'order'   => 'desc'
  25.  
  26. );
  27.  
  28. $product_query = new WP_Query($product_query_args);
  29.  
  30. do_action('woocommerce_before_main_content'); // update woocommerce
  31. ?>
  32. <?php $left_sidebar = (rehub_option('rehub_sidebar_left_shop')) ? true : false; ?>
  33.  
  34.  
  35. <?php if (is_tax('store')) : ?>
  36.   <?php include(rh_locate_template('woocommerce/brandarchive.php')); ?>
  37. <?php else : ?>
  38.  
  39.   <?php $custom_shop_layout = rehub_option('woo_columns'); ?>
  40.   <?php if (is_numeric($custom_shop_layout) && function_exists('rh_wp_reusable_render')) : ?>
  41.     <div class="rh-container rh_woo_main_archive">
  42.       <?php echo rh_wp_reusable_render(array('id' => $custom_shop_layout)); ?>
  43.     </div>
  44.   <?php else : ?>
  45.     <!-- CONTENT -->
  46.     <?php $display_type = ''; ?>
  47.     <?php $display_type = woocommerce_get_loop_display_mode(); ?>
  48.  
  49.     <?php get_sidebar('shop'); ?>
  50.           <!-- /Sidebar -->
  51.      <?php endif; ?>
  52.  
  53.      <?php do_action('woocommerce_before_main_content'); ?>
  54.  
  55.      <?php do_action('woocommerce_archive_description'); ?>
  56.  
  57.      <?php if (woocommerce_product_loop()) : ?>
  58.  
  59.               <?php $shop_global = rehub_option('rh_woo_shop_global'); ?>
  60.  
  61.               <?php if ($shop_global) : ?>
  62.  
  63.                 <?php if ('subcategories' === $display_type || 'both' === $display_type) : ?>
  64.                 <?php endif; ?>
  65.  
  66.                 <div class="clearfix"></div>
  67.                 <?php echo do_shortcode($shop_global); ?>
  68.                 <div class="clearfix"></div>
  69.               <?php else : ?>
  70.                 <?php
  71.                 do_action('woocommerce_before_shop_loop');
  72.  
  73.                 //hot item
  74.                 include(rh_locate_template('woocommerce/hot-item.php'));
  75.                 ?>
  76.                 <?php if (function_exists('woocommerce_get_loop_display_mode')) : ?>
  77.                   <?php if ('subcategories' === $display_type || 'both' === $display_type) : ?>
  78.  
  79.                   <?php endif; ?>
  80.                 <?php endif; ?>
  81.  
  82.  
  83.                 <?php woocommerce_product_loop_start(); ?>
  84.                 <?php if ($display_type != 'subcategories') : ?>
  85.                   <?php if ($product_query->have_posts()) : while ($product_query->have_posts()) : $product_query->the_post(); ?>
  86.                       <?php
  87.                       do_action('woocommerce_shop_loop');
  88.                       wc_get_template_part('content', 'product');
  89.                       ?>
  90.                     <?php endwhile; // end of the loop.
  91.                     ?>
  92.                   <?php endif; ?>
  93.                 <?php endif; ?>
  94.  
  95.                 <?php woocommerce_product_loop_end(); ?>
  96.                
  97.  
  98.                 <?php do_action('woocommerce_after_shop_loop'); ?>
  99.               <?php endif; ?>
  100.             <?php else : ?>
  101.               <?php wc_get_template('loop/no-products-found.php'); ?>
  102.             <?php endif; ?>
  103.             <?php
  104.             if ((is_product_category() || is_product_tag()) && 0 === absint(get_query_var('paged'))) {
  105.               if ($term) {
  106.                 $cat_sec_desc = get_term_meta($termid, 'brand_second_description', true);
  107.                 if ($cat_sec_desc) {
  108.                   echo '<div class="woo_cat_sec_description clearbox">' . wc_format_content($cat_sec_desc) . '</div>';
  109.                 }
  110.               }
  111.             }
  112.             ?>
  113.             <?php do_action('woocommerce_after_main_content');
  114.             ?>
  115.  
  116.  
  117.         <?php if (!$left_sidebar && rehub_option('woo_columns') != '4_col') : ?>
  118.           <!-- Sidebar -->
  119.           <?php echo rh_generate_incss('widgetfilters'); ?>
  120.           <?php get_sidebar('shop'); ?>
  121.           <!-- /Sidebar -->
  122.         <?php endif; ?>
  123.   <?php endif; ?>
  124.  
  125.  
  126. <?php endif; ?>
  127. <?php get_footer('shop'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement