/var/www/(Del)hsihk.com/wp-content/themes/flatsome/woocommerce/archive-product.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
/**
 * The Template for displaying product archives, including the main shop page which is a post type archive.
 *
 * Override this template by copying it to yourtheme/woocommerce/archive-product.php
 *
 * @author         WooThemes
 * @package     WooCommerce/Templates
 * @version     2.0.0
 */

if ( ! defined'ABSPATH' ) ) exit; // Exit if accessed directly
global $flatsome_opt;
get_header('shop'); ?>

<div class="cat-header">
<?php 
// GET CUSTOM HEADER CONTENT FOR CATEGORY
if(function_exists('get_term_meta')){
    
$queried_object get_queried_object();
    
    if (isset(
$queried_object->term_id)){

        
$term_id $queried_object->term_id;  
        
$content get_term_meta($term_id'cat_meta');

        if(isset(
$content[0]['cat_header'])){
            echo 
do_shortcode($content[0]['cat_header']);
        }
    }
}
?>
<?php 
if(isset($flatsome_opt['html_shop_page']) && is_shop()) {
    
// Add Custom HTML for shop page header
    
if($wp_query->query_vars['paged'] == || $wp_query->query_vars['paged'] < 1){
        echo 
do_shortcode($flatsome_opt['html_shop_page']);
    }
?>
</div>


<div class="row category-page">

<?php
    
/**
     * woocommerce_before_main_content hook
     * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
     */
    
do_action('woocommerce_before_main_content');
?>
<div class="large-12 columns">
    <div class="breadcrumb-row">
    <div class="left">
    <?php 
    
/** Output the WooCommerce Breadcrumb  */
    
$defaults = array(
        
'delimiter'  => '<span>/</span>',
        
'wrap_before'  => '<h3 class="breadcrumb">',
        
'wrap_after' => '</h3>',
        
'before'   => '',
        
'after'   => '',
        
'home'    => 'Home'
    
);
    
$args wp_parse_args(  $defaults  );
    
woocommerce_get_template'global/breadcrumb.php'$args );
    
?>
    </div><!-- .left -->

    <div class="right">
        <?php do_action'ux_woocommerce_navigate_products'); ?>        
    </div><!-- .right -->
</div><!-- .breadcrumb-row -->
</div><!-- .large-12 breadcrumb -->



<?php if($flatsome_opt['category_sidebar'] == 'right-sidebar') { ?>
       <div class="large-9 columns left">
<?php } else if ($flatsome_opt['category_sidebar'] == 'left-sidebar') { ?>
        <div class="large-9 columns right">
<?php } else { ?>
        <div class="large-12 columns">
<?php ?>

    <?php if ( have_posts() ) : do_action'woocommerce_before_shop_loop' ); ?><?php endif; ?>
    <?php do_action'woocommerce_archive_description' ); ?>

        <?php if ( have_posts() ) : ?>

            <?php woocommerce_product_loop_start(); ?>

                <?php woocommerce_product_subcategories(); ?>

                <?php while ( have_posts() ) : the_post(); ?>

                    <?php woocommerce_get_template_part'content''product' ); ?>
                <?php endwhile; // end of the loop. ?>

            <?php woocommerce_product_loop_end(); ?>

            <?php
                
/**
                 * woocommerce_after_shop_loop hook
                 *
                 * @hooked woocommerce_pagination - 10
                 */
                
do_action'woocommerce_after_shop_loop' );
            
?>

        <?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_startfalse ), 'after' => woocommerce_product_loop_endfalse ) ) ) ) : ?>

            <?php woocommerce_get_template'loop/no-products-found.php' ); ?>

        <?php endif; ?>

    <?php
        
/**
         * woocommerce_after_main_content hook
         *
         * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
         */
        
do_action('woocommerce_after_main_content');
    
?>

  <?php if( $flatsome_opt['search_result'] && get_search_query() ) : ?>
    <?php
      
/**
       * Include pages and posts in search
       */
      
query_posts( array( 'post_type' => array( 'post''page' ), 's' => get_search_query() ) );

      if(
have_posts()){ echo '<div class="row"><div class="large-12 columns"><hr/>'; }

      while ( 
have_posts() ) : the_post();
        
$wc_page false;
        if(
$post->post_type == 'page'){
          foreach (array(
'myaccount''edit_address''change_password''lost_password''shop''cart''checkout''pay''view_order''thanks''terms') as $wc_page_type) {
            if( 
$post->ID == woocommerce_get_page_id($wc_page_type) ) $wc_page true;
          }
        }
        if( !
$wc_page get_template_part'content'get_post_format() );
      endwhile;

      if(
have_posts()){ echo '</div></div>'; }

      
wp_reset_query();
    
?>
  <?php endif; ?>


                      
 </div><!-- .large-12 -->

<?php if($flatsome_opt['category_sidebar'] == 'right-sidebar') { ?>
<!-- Right Shop sidebar -->
        <div class="large-3 right columns">
            <div class="sidebar-inner">
                <?php dynamic_sidebar('shop-sidebar'); ?>
               </div>
        </div>            
<?php } else if ($flatsome_opt['category_sidebar'] == 'left-sidebar') { ?>
<!-- Left Shop sidebar -->
        <div class="large-3 left columns">
            <div class="sidebar-inner">
                   <?php dynamic_sidebar('shop-sidebar'); ?>
            </div>
        </div>
<?php ?>


</div><!-- end row -->

<?php 
// GET CUSTOM HEADER CONTENT FOR CATEGORY
if(function_exists('get_term_meta')){
    
$queried_object get_queried_object();
    
    if (isset(
$queried_object->term_id)){

        
$term_id $queried_object->term_id;  
        
$content get_term_meta($term_id'cat_meta');

        if(isset(
$content[0]['cat_footer'])){
            echo 
'<div class="row"><div class="large-12 column"><div class="cat-footer"><hr/>';
            echo 
do_shortcode($content[0]['cat_footer']);
            echo 
'</div></div></div>';
        }
    }
}
?>

<?php get_footer('shop'); ?>