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('tab_producs', $atts) : $atts;
        $atts = shortcode_atts(array('taxonomy' => '', 'style' => '1', 'per_page' => 12, 'columns' => 4, 'border_heading' => '', 'css_animation' => '', 'el_class' => '', 'css' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'nav' => 'true', 'loop' => 'false', 'use_responsive' => 1, 'items_destop' => 3, 'items_tablet' => 2, 'items_mobile' => 1), $atts);
        extract($atts);
        global $woocommerce_loop;
        $is_phone = false;
        if (function_exists('kt_is_phone') && kt_is_phone()) {
            $is_phone = true;
        }
        if ($style == 3) {
            $base_class = 'tab-product-13 option-13 style1 ';
        } else {
            $base_class = 'popular-tabs ';
        }
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $base_class, $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));
        $elementClass = apply_filters('kt_product_tab_class_container', $elementClass);
        $tabs = array('best-sellers' => __('Best Sellers', 'edo'), 'on-sales' => __('On Sales', 'edo'), 'new-arrivals' => __('New Products', 'edo'));
        $meta_query = WC()->query->get_meta_query();
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'meta_query' => $meta_query, 'suppress_filter' => true);
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        $uniqeID = uniqid();
        ob_start();
        ?>
        <div class="<?php 
        echo esc_attr($elementClass);
        ?>
 top-nav container-tab style<?php 
        echo esc_attr($style);
        ?>
">
            <ul class="nav-tab">
                <?php 
        $i = 0;
        ?>
                <?php 
        foreach ($tabs as $k => $v) {
            ?>
                    <li <?php 
            echo $i == 0 ? 'class="active"' : '';
            ?>
 >
                        <a data-toggle="tab" href="#tab-<?php 
            echo esc_attr($k) . $uniqeID;
            ?>
"><?php 
            echo esc_html($v);
            ?>
</a>
                    </li>
                    <?php 
            $i++;
            ?>
                <?php 
        }
        ?>
            </ul>
            <div class="tab-container">
                <?php 
        $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'nav' => $navigation, '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 ($style == 3) {
                $data_carousel['items'] = 4;
            } else {
                $data_carousel['items'] = 3;
            }
        }
        $carousel = _data_carousel($data_carousel);
        $i = 0;
        ?>
                <?php 
        foreach ($tabs as $k => $v) {
            ?>
                    <?php 
            $newargs = $args;
            if ($k == 'best-sellers') {
                $newargs['meta_key'] = 'total_sales';
                $newargs['orderby'] = 'meta_value_num';
            } elseif ($k == 'on-sales') {
                $product_ids_on_sale = wc_get_product_ids_on_sale();
                $newargs['post__in'] = array_merge(array(0), $product_ids_on_sale);
                $newargs['orderby'] = 'date';
                $newargs['order'] = 'DESC';
            } else {
                $newargs['orderby'] = 'date';
                $newargs['order'] = 'DESC';
            }
            $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $newargs, $atts));
            if ($products->have_posts()) {
                ?>
                    <!-- Style 1 -->
                    <?php 
                if ($style == 1) {
                    ?>
                    <div id="tab-<?php 
                    echo esc_attr($k) . $uniqeID;
                    ?>
" class="tab-panel <?php 
                    echo $i == 0 ? 'active' : '';
                    ?>
">
                        <ul class="products kt-owl-carousel" <?php 
                    echo apply_filters('kt_shortcode_tab_product_carousel', $carousel);
                    ?>
>
                            <?php 
                    while ($products->have_posts()) {
                        $products->the_post();
                        ?>
                                <li class="product style6 no-hiden">
                                <?php 
                        wc_get_template_part('content', 'product-tab');
                        ?>
                                </li>
                            <?php 
                    }
                    ?>
                        </ul>
                    </div>
                    <!-- ./Style 1 -->
                    <?php 
                }
                ?>
                    <?php 
            }
            ?>
                    <?php 
            wp_reset_query();
            wp_reset_postdata();
            $i++;
            ?>
                <?php 
        }
        ?>
            </div>
        </div>
        <?php 
        return ob_get_clean();
    }
Ejemplo n.º 3
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('product_sidebar', $atts) : $atts;
        $atts = shortcode_atts(array('title' => __('NEW PRODUCTS', 'kutetheme'), 'style' => 'style-1', 'target' => 'best-seller', 'orderby' => 'date', 'order' => 'DESC', 'ids' => '', 'taxonomy' => '', 'number_product' => 14, 'per_page' => 7, 'css_animation' => '', 'el_class' => '', 'css' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'nav' => 'true', 'loop' => 'false'), $atts);
        extract($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, ' ', $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));
        $elementClass = apply_filters('kt_product_sidebar_class_container', $elementClass);
        $tabs = array('best-sellers' => __('Best Sellers', 'kutetheme'), 'on-sales' => __('On Sales', 'kutetheme'), 'new-arrivals' => __('New Products', 'kutetheme'));
        $meta_query = WC()->query->get_meta_query();
        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $number_product, 'meta_query' => $meta_query, 'suppress_filter' => true);
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        $data_carousel = array("autoplay" => $autoplay, "nav" => $navigation, "margin" => $margin, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'items' => 1, 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        if ($target == 'new-arrival') {
            $args['orderby'] = 'date';
            $args['order'] = 'DESC';
        } elseif ($target == 'on-sales') {
            $product_ids_on_sale = wc_get_product_ids_on_sale();
            $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
            if ($orderby == '_sale_price') {
                $orderby = 'date';
                $order = 'DESC';
            }
            $args['orderby'] = $orderby;
            $args['order'] = $order;
        } elseif ($target == 'custom') {
            if ($orderby == '_sale_price') {
                $args['meta_query'] = array('relation' => 'OR', array('key' => '_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'), array('key' => '_min_variation_sale_price', 'value' => 0, 'compare' => '>', 'type' => 'numeric'));
            } else {
                $args['orderby'] = $orderby;
                $args['order'] = $order;
            }
        } elseif ($target == 'most-review') {
            add_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        } elseif ($target == 'by-ids' && count($ids) > 0) {
            $args['post__in'] = $ids;
            $args['orderby'] = 'post__in';
        } else {
            $args['meta_key'] = 'total_sales';
            $args['orderby'] = 'meta_value_num';
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        if ($target == 'most-review') {
            remove_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        }
        remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
        $uniqeID = uniqid();
        ob_start();
        if ($products->have_posts()) {
            if ($style == 'style-1') {
                ?>
            <div class="block-new-product12 <?php 
                echo esc_attr($elementClass);
                ?>
">
                <?php 
                if ($title) {
                    ?>
                    <div class="title"><?php 
                    echo esc_html($title);
                    ?>
</div>
                <?php 
                }
                ?>
                <div class="inner owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                    <?php 
                $i = 1;
                ?>
                    <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                    <?php 
                    if ($i == 1) {
                        ?>
                    <ul class="list-product">
                    <?php 
                    }
                    ?>
                        <li class="product">
                            <div class="image">
                                <a href="<?php 
                    the_permalink();
                    ?>
">
                                    <?php 
                    echo kt_get_product_thumbnail('shop_thumbnail');
                    ?>
                                </a>
                            </div>
                            <div class="info">
                                <h3 class="product-name"><a title="<?php 
                    echo esc_attr(get_the_title());
                    ?>
" href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    echo esc_attr(get_the_title());
                    ?>
</a></h3>
                                <?php 
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     * 
                     * @hooked woocommerce_template_loop_price - 5
                     * @hooked woocommerce_template_loop_rating - 10
                     */
                    do_action('kt_after_shop_loop_item_title');
                    ?>
                            </div>
                        </li>
                    <?php 
                    if ($i == $per_page) {
                        $i = 1;
                        echo '</ul><!--End Ul-->';
                    } else {
                        $i++;
                    }
                    ?>
                    
                    <?php 
                }
                ?>
                    <?php 
                if ($i > 1) {
                    ?>
                    </ul><!--./ End ul-->
                    <?php 
                }
                ?>
                </div>
            </div>
            <?php 
            } else {
                add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
                ?>
                <div class="block-static option-14">
                    <?php 
                if ($title) {
                    ?>
                        <h3 class="title"><span><?php 
                    echo esc_html($title);
                    ?>
</span></h3>
                    <?php 
                }
                ?>
                    <div class="block-static-products owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                        <?php 
                $i = 1;
                ?>
                        <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                        <?php 
                    if ($i == 1) {
                        ?>
                        <ul class="list">
                        <?php 
                    }
                    ?>
                            <li>
                                <div class="product-thumb">
                                    <a href="<?php 
                    the_permalink();
                    ?>
">
                                        <?php 
                    echo kt_get_product_thumbnail('shop_thumbnail');
                    ?>
                                    </a>
                                </div>
                                <div class="product-info">
                                    <h3 class="product-name">
                                        <a title="<?php 
                    echo esc_attr(get_the_title());
                    ?>
" href="<?php 
                    the_permalink();
                    ?>
">
                                            <?php 
                    echo esc_attr(get_the_title());
                    ?>
                                        </a>
                                    </h3>
                                    <?php 
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     * 
                     * @hooked woocommerce_template_loop_price - 5
                     * @hooked woocommerce_template_loop_rating - 10
                     */
                    do_action('kt_after_shop_loop_item_title');
                    ?>
                                    <div class="group-button-control">
                                        <?php 
                    woocommerce_template_loop_add_to_cart();
                    ?>
                                        <?php 
                    kt_get_tool_wishlish();
                    ?>
                                        <?php 
                    kt_get_tool_compare();
                    ?>
                                        <?php 
                    kt_get_tool_quickview();
                    ?>
                                    </div>
                                </div>
                            </li>
                            
                        <?php 
                    if ($i == $per_page) {
                        $i = 1;
                        echo '</ul><!--End Ul-->';
                    } else {
                        $i++;
                    }
                    ?>
                        <?php 
                }
                ?>
                        <?php 
                if ($i > 1) {
                    ?>
                        </ul><!--./ End ul-->
                        <?php 
                }
                ?>
                    </div>
                </div>
            <?php 
            }
        }
        add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
        wp_reset_query();
        wp_reset_postdata();
        return ob_get_clean();
    }