Ejemplo n.º 1
0
 protected function content($atts, $content = null)
 {
     $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('categories_tab', $atts) : $atts;
     extract(shortcode_atts(array('title' => 'Tabs Name', 'tabs_type' => 'tab-1', 'per_page' => 10, 'column' => 4, 'category' => 0, 'main_color' => '#ff3366', 'icon' => '', 'bg_cate' => '', 'banner_top' => '', 'banner_left' => '', "featured" => false, "align" => 'left', "number_slide" => 14, 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 0, 'slidespeed' => 250, 'css' => '', 'css_animation' => '', 'el_class' => '', 'nav' => 'true', 'loop' => 'false', 'use_responsive' => 1, 'items_destop' => 4, 'items_tablet' => 2, 'items_mobile' => 1), $atts));
     global $woocommerce_loop;
     $is_phone = false;
     if (function_exists('kt_is_phone') && kt_is_phone()) {
         $is_phone = true;
     }
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' box-tab-category ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     if (function_exists('kt_hex2rgb')) {
         $main_color_rgb = kt_hex2rgb($main_color);
     } else {
         $main_color_rgb = array('red' => 255, 'green' => 51, 'blue' => 102);
     }
     $elementClass = apply_filters('kt_category_tab_class_container', $elementClass);
     $tabs = kt_get_all_attributes('tab_section', $content);
     $id = uniqid($category);
     $term = get_term($category, 'product_cat');
     if (isset($bg_cate) && $bg_cate) {
         $att_bg = wp_get_attachment_image_src($bg_cate, 'full');
         $att_bg_url = is_array($att_bg) ? esc_url($att_bg[0]) : "";
         if ($att_bg_url) {
             $style = "style='background: #fff url(" . $att_bg_url . ") no-repeat left bottom;'";
         }
     }
     if (count($tabs) > 0 && $term) {
         $term_link = get_term_link($term);
         if (!$is_phone) {
             $args = array('hierarchical' => 1, 'show_option_none' => '', 'hide_empty' => 0, 'parent' => $term->term_id, 'taxonomy' => 'product_cat');
             $subcats = get_categories($args);
         }
         if (file_exists(KUTETHEME_PLUGIN_PATH . '/js_composer/includes/' . $tabs_type . '.php')) {
             if ($tabs_type == 'tab-1') {
                 $elementClass .= ' option1 tab-1';
             } elseif ($tabs_type == 'tab-2') {
                 $elementClass .= ' option2 tab-2';
             } elseif ($tabs_type == 'tab-3') {
                 $elementClass .= ' option2 tab-3';
             } elseif ($tabs_type == 'tab-4') {
                 $elementClass .= ' option2 tab-4';
             } elseif ($tabs_type == 'tab-5') {
                 $elementClass .= ' option2 tab-5';
             } elseif ($tabs_type == 'tab-6') {
                 $elementClass .= ' option7 tab-6';
             } elseif ($tabs_type == 'tab-7') {
                 $elementClass .= ' option7 tab-7';
             }
             @(include KUTETHEME_PLUGIN_PATH . 'js_composer/includes/' . $tabs_type . '.php');
         }
     }
 }
Ejemplo n.º 2
0
 protected function content($atts, $content = null)
 {
     $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('categories_tab', $atts) : $atts;
     extract(shortcode_atts(array('title' => 'Tabs Name', 'tabs_type' => 'tab-1', 'per_page' => 10, 'column' => 4, 'category' => 0, 'main_color' => '#ff3366', 'icon' => '', 'banner_top' => '', 'banner_left' => '', "featured" => false, 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 0, 'slidespeed' => 250, 'css' => '', 'css_animation' => '', 'el_class' => '', 'nav' => 'true', 'loop' => 'true', 'use_responsive' => 0, 'items_destop' => 4, 'items_tablet' => 2, 'items_mobile' => 1), $atts));
     global $woocommerce_loop;
     $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'container ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
     $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
     if (function_exists('kt_hex2rgb')) {
         $main_color_rgb = kt_hex2rgb($main_color);
     } else {
         $main_color_rgb = array('red' => 255, 'green' => 51, 'blue' => 102);
     }
     $elementClass = apply_filters('kt_category_tab_class_container', $elementClass);
     $tabs = kt_get_all_attributes('tab_section', $content);
     $id = uniqid($category);
     $term = get_term($category, 'product_cat');
     if (count($tabs) > 0 && $term) {
         $term_link = get_term_link($term);
         $args = array('hierarchical' => 1, 'show_option_none' => '', 'hide_empty' => 0, 'parent' => $term->term_id, 'taxonomy' => 'product_cat');
         $subcats = get_categories($args);
         if (file_exists(THEME_DIR . 'js_composer/includes/' . $tabs_type . '.php')) {
             if ($tabs_type == 'tab-1') {
                 $elementClass .= ' option1 tab-1';
             } elseif ($tabs_type == 'tab-2') {
                 $elementClass .= ' option2 tab-2';
             } elseif ($tabs_type == 'tab-3') {
                 $elementClass .= ' option2 tab-3';
             } elseif ($tabs_type == 'tab-4') {
                 $elementClass .= ' option2 tab-4';
             } elseif ($tabs_type == 'tab-5') {
                 $elementClass .= ' option2 tab-5';
             } elseif ($tabs_type == 'tab-6') {
                 $elementClass .= ' option6 tab-6';
             } elseif ($tabs_type == 'tab-7') {
                 $elementClass .= ' option7 tab-7';
             }
             @(include locate_template('js_composer/includes/' . $tabs_type . '.php'));
         }
     }
 }
Ejemplo n.º 3
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('hot_deal', $atts) : $atts;
        extract(shortcode_atts(array('title' => 'Tabs Name', 'per_page' => 5, 'taxonomy' => 0, 'orderby' => 'date', 'order' => 'DESC', 'style' => 'style-1', 'autoplay' => 'false', 'navigation' => 'false', 'loop' => 'false', 'slidespeed' => 250, 'margin' => 0, 'css' => '', 'el_class' => '', 'nav' => 'true', 'items_destop' => 4, 'items_tablet' => 3, 'items_mobile' => 1, 'use_responsive' => 1, 'css_animation' => ''), $atts));
        global $woocommerce_loop;
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' box-tab-category ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
        $meta_query = WC()->query->get_meta_query();
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order);
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        $product_ids_on_sale = wc_get_product_ids_on_sale();
        $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
        $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'nav' => 'true', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        if ($use_responsive) {
            $arr = array('0' => array("items" => $items_mobile), '768' => array("items" => $items_tablet), '992' => array("items" => $items_destop));
            $data_responsive = json_encode($arr);
            $data_carousel["responsive"] = $data_responsive;
        } else {
            if ($items_destop > 0) {
                $items_destop = 4;
            }
            $data_carousel['items'] = $items_destop;
        }
        $carousel = _data_carousel($data_carousel);
        $tabs = kt_get_all_attributes('tab_sections', $content);
        if (count($tabs) > 0) {
            $unique = uniqid();
            $new_title = array(__('hot'), __('deals'));
            $charact = explode(' ', $title);
            if (is_array($charact) && count($charact) > 1) {
                $new_title = $charact;
            }
            ?>
        <?php 
            ob_start();
            ?>
        <div class="<?php 
            if ($style == "style-1") {
                ?>
 option3 <?php 
            } else {
                ?>
 option4 <?php 
            }
            ?>
">
            <!-- Hot deals -->
            <div class="hot-deals-row container-tab">
                <div class="hot-deals-box only_countdown">
                    <div class="row">
                        <div class="col-sm-12 col-md-12 col-lg-4">
                            <div class="hot-deals-tab">
                                <div class="hot-deals-title vertical-text">
                                    <?php 
            if (isset($new_title[0]) && $new_title[0]) {
                ?>
                                        <?php 
                for ($i = 0; $i < strlen($new_title[0]); $i++) {
                    ?>
                                            <?php 
                    if (isset($new_title[0][$i])) {
                        ?>
                                                <span><?php 
                        echo esc_html($new_title[0][$i]);
                        ?>
</span>
                                            <?php 
                    }
                    ?>
                                        <?php 
                }
                ?>
                                    <?php 
            }
            ?>
                                    
                                    <?php 
            for ($j = 1; $j < count($new_title); $j++) {
                ?>
                                        <?php 
                if (isset($new_title[$j]) && $new_title[$j]) {
                    ?>
                                            <?php 
                    for ($i = 0; $i < strlen($new_title[$j]); $i++) {
                        ?>
                                                <?php 
                        if (isset($new_title[$j][$i])) {
                            ?>
                                                    <span class="yellow"><?php 
                            echo esc_html($new_title[$j][$i]);
                            ?>
</span>
                                                <?php 
                        }
                        ?>
                                            <?php 
                    }
                    ?>
                                        <?php 
                }
                ?>
                                    <?php 
            }
            ?>
                                </div>
                                <div class="hot-deals-tab-box">
                                    <ul class="nav-tab">
                                        <?php 
            $i = 1;
            ?>
                                            <?php 
            foreach ($tabs as $tab) {
                extract(shortcode_atts(array('header' => __('Tab name', 'kutetheme'), 'reduction_from' => 0, 'reduction_to' => 0), $tab));
                ?>
                                              <li <?php 
                if ($i == 1) {
                    ?>
 class="active" <?php 
                }
                ?>
 ><a data-toggle="tab" href="#hotdeals-<?php 
                echo $unique;
                ?>
-<?php 
                echo $i;
                ?>
"><?php 
                echo $header;
                ?>
</a></li>
                                              <?php 
                $i++;
                ?>
                                            <?php 
            }
            ?>
                                    </ul>
                                    <div class="box-count-down">
                                        <span class="countdown-only"></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-12 col-md-12 col-lg-8 hot-deals-tab-content-col">
                            <div class="hot-deals-tab-content tab-container">
                                <?php 
            $i = 1;
            ?>
                                <?php 
            $max_time = 0;
            foreach ($tabs as $tab) {
                extract(shortcode_atts(array('header' => __('Tab name', 'kutetheme'), 'reduction_from' => 0, 'reduction_to' => 0), $tab));
                $meta = $meta_query;
                $meta[] = array('key' => '_reduction_percent', 'value' => array($reduction_from, $reduction_to), 'compare' => 'BETWEEN');
                $args['meta_query'] = $meta;
                $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
                if ($products->have_posts()) {
                    add_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
                    add_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2);
                    remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
                    ?>
                                    <div id="hotdeals-<?php 
                    echo $unique;
                    ?>
-<?php 
                    echo $i;
                    ?>
" class="tab-panel <?php 
                    if ($i == 1) {
                        ?>
active<?php 
                    }
                    ?>
">
                                        <?php 
                    do_action("woocommerce_shortcode_before_hot_deal_loop");
                    ?>
                                        <ul class="product-list owl-carousel nav-center" <?php 
                    echo $carousel;
                    ?>
>
                                            <?php 
                    while ($products->have_posts()) {
                        $products->the_post();
                        ?>
                                                <li>
                                					<?php 
                        wc_get_template_part('content', 'product-hot-deal');
                        // Get date sale
                        $time = kt_get_max_date_sale(get_the_ID());
                        if ($time > $max_time) {
                            $max_time = $time;
                        }
                        ?>
                                                </li>
                                			<?php 
                    }
                    ?>
                                        </ul>
                                    <?php 
                    do_action("woocommerce_shortcode_after_hot_deal_loop");
                    ?>
                                    </div> 
                                <?php 
                    remove_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
                    remove_filter('woocommerce_sale_price_html', 'woocommerce_custom_sales_price', 10, 2);
                    add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
                    ?>
                                <?php 
                } else {
                    ?>
                                    <div id="hotdeals-<?php 
                    echo $unique;
                    ?>
-<?php 
                    echo $i;
                    ?>
" class="tab-panel <?php 
                    if ($i == 1) {
                        ?>
active<?php 
                    }
                    ?>
">
                                        <label><?php 
                    _e('Empty product', 'kutetheme');
                    ?>
</label>
                                    </div>
                                <?php 
                }
                ?>
                                <?php 
                wp_reset_query();
                wp_reset_postdata();
                ?>
                                <?php 
                $i++;
                ?>
                                <?php 
            }
            ?>
                                <?php 
            if ($max_time > 0) {
                $y = date('Y', $max_time);
                $m = date('m', $max_time);
                $d = date('d', $max_time);
                ?>
                                    <input class="max-time-sale" data-y="<?php 
                echo esc_attr($y);
                ?>
" data-m="<?php 
                echo esc_attr($m);
                ?>
" data-d="<?php 
                echo esc_attr($d);
                ?>
" type="hidden" value="" />
                                    <?php 
            }
            ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- ./Hot deals -->
        <?php 
        }
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }