Ejemplo n.º 1
0
    public function widget($args, $instance)
    {
        echo $args['before_widget'];
        $title = isset($instance['title']) ? $instance['title'] : '';
        $number = isset($instance['number']) ? $instance['number'] : 3;
        $orderby = isset($instance['orderby']) ? $instance['orderby'] : 'date';
        $order = isset($instance['order']) ? $instance['order'] : 'desc';
        $data_carousel = array("autoplay" => $instance['autoplay'], "slidespeed" => $instance['slidespeed'], "theme" => 'style-navigation-bottom', 'nav' => false, 'loop' => $instance['loop'], 'items' => 1);
        if ($title != "") {
            echo $args['before_title'];
            echo $title;
            echo $args['after_title'];
        }
        $pages = new WP_Query(array('post_type' => 'testimonial', 'numbe' => $number));
        if ($pages->have_posts()) {
            ?>
           <!-- Testimonials -->
            <div class="block left-module container-testimonials">
                <div class="block_content">
                    <ul class="testimonials owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                        <?php 
            while ($pages->have_posts()) {
                $pages->the_post();
                ?>
                        <li>
                            <div class="client-mane"><a target="_blank" href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a></div>
                            <div class="client-avarta">
                                <?php 
                the_post_thumbnail('110x110');
                ?>
                            </div>
                            <div class="testimonial">
                                <?php 
                the_content();
                ?>
                            </div>
                        </li>
                        <?php 
            }
            ?>
                    </ul>
                </div>
            </div>
            <!-- ./Testimonials -->
       <?php 
        }
        wp_reset_query();
        wp_reset_postdata();
        echo $args['after_widget'];
    }
Ejemplo n.º 2
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('lastest_deals_sidebar', $atts) : $atts;
        $atts = shortcode_atts(array('title' => '', 'taxonomy' => '', 'number' => 12, 'autoplay' => "false", 'navigation' => "false", 'slidespeed' => 250, 'loop' => "false", 'items' => 1, 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'latest-deals ', $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_lastest_deals_sidebar_class_container', $elementClass);
        // Get products on sale
        $product_ids_on_sale = wc_get_product_ids_on_sale();
        $meta_query = WC()->query->get_meta_query();
        $args = array('posts_per_page' => $number, 'post_type' => 'product', 'orderby' => 'meta_value_num', 'meta_key' => '_sale_price_dates_to', 'order' => 'DESC', 'no_found_rows' => 1, 'post_status' => 'publish', 'meta_query' => $meta_query, 'post__in' => array_merge(array(0), $product_ids_on_sale));
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        $q = apply_filters('woocommerce_shortcode_products_query', $args, $atts);
        $query = new WP_Query($q);
        global $woocommerce_loop;
        ob_start();
        if ($query->have_posts()) {
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "slidespeed" => $slidespeed, "autoheight" => "false", "loop" => $loop, "dots" => "false", 'nav' => "true", "autoplayTimeout" => 1000, "autoplayHoverPause" => "true", 'items' => 1);
            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);
            ?>
            <div class="<?php 
            echo esc_attr($elementClass);
            ?>
">
                <h2 class="latest-deal-title"><?php 
            echo esc_html($title);
            ?>
</h2>
                <div class="latest-deal-content">
                    <ul class="product-list owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                        <?php 
            add_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
            while ($query->have_posts()) {
                $query->the_post();
                wc_get_template_part('content', 'product-sidebar');
            }
            // end of the loop.
            remove_filter("woocommerce_get_price_html_from_to", "kt_get_price_html_from_to", 10, 4);
            ?>
                    </ul>
                </div>
            </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);
        }
        wp_reset_postdata();
        wp_reset_query();
        $result = ob_get_contents();
        ob_clean();
        return $result;
    }
Ejemplo n.º 3
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('banner_carousel', $atts) : $atts;
        $atts = shortcode_atts(array('autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 250, 'nav' => 'true', 'loop' => 'true', 'use_responsive' => 0, 'items_destop' => 3, 'items_tablet' => 2, 'items_mobile' => 1, 'css' => '', 'css_animation' => '', 'width_class' => ''), $atts);
        extract($atts);
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'block block-banner-owl ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($width_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));
        $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-top', "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 {
            $data_carousel['items'] = 3;
        }
        ob_start();
        ?>
        <!-- block banner owl-->
        <div class="<?php 
        echo esc_attr($elementClass);
        ?>
" >
    		<div class="block-inner kt-owl-carousel" <?php 
        echo _data_carousel($data_carousel);
        ?>
>
    			<?php 
        echo do_shortcode(shortcode_unautop($content));
        ?>
    		</div>
    	</div>
        <!-- ./block banner owl-->
        <?php 
        $result = ob_get_clean();
        return $result;
    }
Ejemplo n.º 4
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('kt_featured_products', $atts) : $atts;
        $atts = shortcode_atts(array('title' => __('Hot Categories', 'kutetheme'), 'size' => 'kt_shop_catalog_270', 'display_type' => '1', 'box_type' => 'featured', 'ids' => '', 'number' => 4, 'css_animation' => '', 'el_class' => '', 'css' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'loop' => 'false', 'use_responsive' => 1, 'items_destop' => 3, 'items_tablet' => 2, 'items_mobile' => 1), $atts);
        extract($atts);
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' trending ', $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));
        $data_carousel = array("autoplay" => $autoplay, "nav" => $navigation, "margin" => $margin, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        ob_start();
        $args = array('post_type' => 'product', 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => $number);
        if ($ids) {
            $ids = explode(',', $ids);
        } else {
            $ids = array();
        }
        if ($box_type == 'by_id') {
            $args = array('post_type' => 'product', 'post__in' => $ids);
        }
        $products = get_posts($args);
        $count = count($products);
        $per_page = 2;
        $loop = false;
        if ($count > 2) {
            $loop = true;
        }
        ?>
        <!-- Style 1 -->
        <?php 
        if ($display_type == 1) {
            ?>
        <div class=" <?php 
            echo esc_attr($elementClass);
            ?>
">
            <?php 
            if ($title) {
                ?>
            <h2 class="trending-title"><?php 
                echo esc_html($title);
                ?>
</h2>
            <?php 
            }
            ?>
            <div class="trending-product owl-carousel nav-center" data-items="1" data-dots="false" data-nav="true" data-autoplay="true" <?php 
            if ($loop) {
                ?>
 data-loop="true" <?php 
            }
            ?>
>
                <?php 
            $page = 1;
            if ($count % $per_page == 0) {
                $page = $count / $per_page;
            } else {
                $page = $count / $per_page + 1;
            }
            ?>
                <?php 
            for ($i = 1; $i <= $page; $i++) {
                ?>
                    <ul>
                        <?php 
                $from = ($i - 1) * $per_page;
                $to = $i * $per_page;
                for ($from; $from < $to; $from++) {
                    if (isset($products[$from]) && $products[$from]) {
                        $p = $products[$from];
                        $product = new WC_Product($p->ID);
                        ?>
                                    <li>
                                        <div class="product-container">
                                            <div class="product-image">
                                                <a href="<?php 
                        echo get_permalink($p->ID);
                        ?>
">
                                                   <?php 
                        echo get_the_post_thumbnail($p->ID, $size);
                        ?>
                                                </a>
                                            </div>
                                            <div class="product-info">
                                                <h5 class="product-name">
                                                    <a href="<?php 
                        echo get_permalink($p->ID);
                        ?>
"><?php 
                        echo esc_html($p->post_title);
                        ?>
</a>
                                                </h5>
                                                <div class="product-price">
                                                    <?php 
                        echo $product->get_price_html();
                        ?>
                                                </div>
                                            </div>
                                        </div>
                                    </li>
                                <?php 
                    }
                }
                ?>
                    </ul>
                <?php 
            }
            ?>
            </div>
        </div>
        <?php 
        }
        ?>
        <!-- Style 2 -->
        <?php 
        if ($display_type == 2) {
            ?>
            <?php 
            $products = new WP_Query($args);
            ?>
            <?php 
            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;
                if ($products->post_count < $items_mobile || $products->post_count < $items_tablet || $products->post_count < $items_destop) {
                    $data_carousel['loop'] = 'false';
                } else {
                    $data_carousel['loop'] = $loop;
                }
            } else {
                $data_carousel['items'] = 3;
                if ($products->post_count < 3) {
                    $data_carousel['loop'] = 'false';
                } else {
                    $data_carousel['loop'] = $loop;
                }
            }
            ?>
            <div class="section8 block-trending <?php 
            echo esc_attr($elementClass);
            ?>
">
            <h3 class="section-title"><?php 
            echo esc_html($title);
            ?>
</h3>
            <?php 
            if ($products->have_posts()) {
                ?>
            <ul class="products-style8 owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                <li class="product autoHeight-item">
                    <div class="product-container">
                        <div class="product-thumb">
                            <?php 
                    $product = new WC_Product(get_the_ID());
                    $attachment_ids = $product->get_gallery_attachment_ids();
                    $secondary_image = '';
                    if ($attachment_ids) {
                        $secondary_image = wp_get_attachment_image($attachment_ids[0], $size);
                    }
                    if (has_post_thumbnail()) {
                        ?>
                                    <a class="primary_image" href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_post_thumbnail($size);
                        ?>
</a>
                                <?php 
                    } else {
                        ?>
                                    <a class="primary_image" href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        echo wc_placeholder_img($size);
                        ?>
</a>
                                <?php 
                    }
                    if ($secondary_image != "") {
                        ?>
                                    <a class="secondary_image" href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        echo $secondary_image;
                        ?>
</a>
                                <?php 
                    } else {
                        ?>
                                    <a class="secondary_image" href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        echo wc_placeholder_img($size);
                        ?>
</a>
                                <?php 
                    }
                    ?>
                            <?php 
                    kt_get_tool_quickview();
                    ?>
                            <div class="product-label"><?php 
                    do_action('kt_loop_product_label');
                    ?>
</div>
                        </div>
                        <div class="product-info">
                            <div class="product-name">
                                <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a>
                            </div>
                            <div class="box-price">
                                <?php 
                    do_action('kt_after_shop_loop_item_title');
                    ?>
                            </div>
                            <div class="button-control">
                                <?php 
                    kt_get_tool_compare();
                    ?>
                                <?php 
                    do_action('woocommerce_after_shop_loop_item');
                    ?>
                                <?php 
                    kt_get_tool_wishlish();
                    ?>
                            </div>
                        </div>
                    </div>
                </li>
                <?php 
                }
                ?>
            </ul>
            <?php 
            }
            ?>
.
            </div>
        <?php 
        }
        ?>
        <?php 
        wp_reset_postdata();
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }
Ejemplo n.º 5
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.º 6
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('box_products', $atts) : $atts;
        extract(shortcode_atts(array('title' => __('hot deals', 'kutetheme'), 'per_page' => 5, 'type' => 'hot-deals', 'taxonomy' => 0, 'orderby' => 'date', 'order' => 'DESC', 'main_color' => '#ff3300', 'style' => 'style-1', 'banner' => '', 'banner_link' => '', 'speed_banner' => '250', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 20, 'slidespeed' => 250, 'nav' => 'true', 'loop' => 'true', 'use_responsive' => 1, 'items_destop' => 4, 'items_tablet' => 2, 'items_mobile' => 1, 'css' => '', 'css_animation' => '', 'el_class' => ''), $atts));
        global $woocommerce_loop;
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'box-products ', $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);
        }
        ob_start();
        $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, 'meta_query' => $meta_query);
        if ($type == 'hot-deals') {
            $product_ids_on_sale = wc_get_product_ids_on_sale();
            $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
            if ($orderby == 'discount') {
                $newargs['meta_key'] = '_reduction_percent';
                $newargs['orderby'] = 'meta_value_num';
            } else {
                $args['orderby'] = $orderby;
            }
            $args['order'] = $order;
            if (!$title) {
                $title = __('Hot Deals', 'kutetheme');
            }
        } elseif ($type == 'best-selling') {
            $newargs['meta_key'] = 'total_sales';
            $newargs['orderby'] = 'meta_value_num';
            if (!$title) {
                $title = __('Best Selling', 'kutetheme');
            }
        } elseif ($type == 'recent-product') {
            $args['orderby'] = $orderby;
            $args['order'] = $order;
            if (!$title) {
                $title = __('New Arrivals', 'kutetheme');
            }
        } elseif ($type == 'most-review') {
            add_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
            if (!$title) {
                $title = __('Most Reviews', 'kutetheme');
            }
        }
        $cate_ids = array();
        if ($taxonomy) {
            $cate_ids = explode(",", $taxonomy);
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $cate_ids));
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        if ($products->have_posts()) {
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-top', "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 {
                $data_carousel['items'] = $items_destop;
            }
            $unique_id = uniqid();
            $carousel = _data_carousel($data_carousel);
            $banner_i = 1;
            if (isset($banner) && $banner) {
                $banner_args = array('post_type' => 'attachment', 'include' => $banner, 'orderby' => 'post__in');
                $list_banner = get_posts($banner_args);
                ob_start();
                foreach ($list_banner as $l) {
                    ?>
                    <li>
                        <a target="_blank" href="<?php 
                    echo $banner_link ? esc_url($banner_link) : '';
                    ?>
">
                            <?php 
                    echo wp_get_attachment_image($l->ID, 'full');
                    ?>
                        </a>
                    </li>
                <?php 
                    $banner_i++;
                }
                $banner_carousel = ob_get_clean();
            }
            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 class="container-tab <?php 
            if ($style == "style-1") {
                ?>
 option3 <?php 
            } else {
                ?>
 option4 <?php 
            }
            ?>
">
                <!-- box product -->
                <div class="<?php 
            echo apply_filters('kt_class_box_product', $elementClass);
            ?>
" id="change-color-<?php 
            echo esc_attr($unique_id);
            ?>
" data-target="change-color" data-color="<?php 
            echo esc_attr($main_color);
            ?>
" data-rgb="<?php 
            echo esc_attr(implode(',', $main_color_rgb));
            ?>
">
                    <div class="box-product-head">
                        <span class="box-title"><?php 
            echo esc_html($title);
            ?>
</span>
                        <ul class="box-tabs nav-tab">
                            <li class="active">
                                <a data-toggle="tab" href="#tab-all-<?php 
            echo $unique_id;
            ?>
">
                                    <?php 
            _e('All', 'edo');
            ?>
                                </a>
                            </li>
                            
                            <?php 
            if (count($cate_ids)) {
                ?>
                                <?php 
                foreach ($cate_ids as $id) {
                    ?>
                                    <?php 
                    $term = get_term($id, 'product_cat');
                    $cate_obj[] = $term;
                    ?>
                                    <li>
                                        <a data-toggle="tab" href="#tab-<?php 
                    echo esc_attr($term->term_id . '-' . $unique_id);
                    ?>
">
                                            <?php 
                    echo esc_html($term->name);
                    ?>
                                        </a>
                                    </li>
                                <?php 
                }
                ?>
                            <?php 
            }
            ?>
                        </ul>
                    </div>
                    <div class="box-product-content">
                        <?php 
            if (isset($banner_carousel)) {
                ?>
                        <div class="box-product-adv">
                            <ul class="owl-carousel nav-center" data-slidespeed="<?php 
                echo intval($speed_banner);
                ?>
" data-items="1" data-dots="false"  <?php 
                if ($banner_i > 2) {
                    ?>
 data-autoplay="true" data-loop="true" <?php 
                } else {
                    ?>
 data-autoplay="false" data-loop="false" <?php 
                }
                ?>
  data-nav="true">
                                <?php 
                echo apply_filters('kt_banner_box_product', $banner_carousel);
                ?>
                            </ul>
                        </div>
                        <?php 
            }
            ?>
                        <div class="box-product-list" <?php 
            if (!isset($banner_carousel)) {
                ?>
 style="margin-left: 0;" <?php 
            }
            ?>
>
                            <div class="tab-container">
                                <div id="tab-all-<?php 
            echo esc_attr($unique_id);
            ?>
" class="tab-panel active">
    								<?php 
            do_action("woocommerce_shortcode_before_box_product_loop");
            ?>
                                        <?php 
            $this->kt_loop_product($products, $carousel);
            ?>
                                    <?php 
            do_action("woocommerce_shortcode_after_box_product_loop");
            ?>
    							</div>
                                <?php 
            if (count($cate_obj) > 0) {
                ?>
                                    <?php 
                foreach ($cate_obj as $term) {
                    $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $term->term_id));
                    $term_products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
                    if ($term_products->have_posts()) {
                        ?>
            							<div id="tab-<?php 
                        echo $term->term_id . '-' . $unique_id;
                        ?>
" class="tab-panel">
            								<?php 
                        do_action("woocommerce_shortcode_before_box_product_loop");
                        ?>
                                                <?php 
                        $this->kt_loop_product($term_products, $carousel);
                        ?>
                                            <?php 
                        do_action("woocommerce_shortcode_after_box_product_loop");
                        ?>
            							</div>
                                        <?php 
                    } else {
                        ?>
                                            <div id="tab-<?php 
                        echo $term->term_id . '-' . $unique_id;
                        ?>
" class="tab-panel">
                                                <?php 
                        $this->kt_tab_empty();
                        ?>
                                            </div>
                                        <?php 
                    }
                    ?>
                                    <?php 
                }
                ?>
                                <?php 
            }
            ?>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- ./box product -->
            </div>
            <?php 
            add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
            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);
            if ($type == 'most-review') {
                remove_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
            }
        }
        return ob_get_clean();
    }
Ejemplo n.º 7
0
        } else {
            if ($product_column > 0) {
                $data_carousel['items'] = $product_column;
            }
        }
        ?>
                        <!-- tab product -->
                        <div class="tab-panel <?php 
        echo $i == 0 ? 'active' : '';
        ?>
" id="<?php 
        echo 'tab-' . $id . '-' . $i;
        ?>
">
                            <ul class="product-list tab-owl owl-carousel" <?php 
        echo _data_carousel($data_carousel);
        ?>
>
                                <?php 
        while ($products->have_posts()) {
            $products->the_post();
            wc_get_template_part('content', 'product-tab');
        }
        // end of the loop.
        ?>
                            </ul>
                        </div>
                        <?php 
    }
    wp_reset_query();
    wp_reset_postdata();
Ejemplo n.º 8
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('kt_colection', $atts) : $atts;
        $atts = shortcode_atts(array('title' => '', 'display_type' => '1', 'taxonomy' => '', 'number' => 4, '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);
        $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(' section8 block-collections ', ''), implode(' ', $elementClass));
        $data_carousel = array("autoplay" => $autoplay, "nav" => $navigation, "margin" => $margin, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        if (!$taxonomy) {
            $terms = get_terms('colection_cat', array('hide_empty' => false));
        } else {
            $taxonomy = explode(',', $taxonomy);
            $terms = get_terms('colection_cat', array('hide_empty' => false, 'include' => $taxonomy));
        }
        ob_start();
        ?>
        <!-- Style 1 -->
        <?php 
        if ($display_type == 1) {
            ?>
        <div class=" <?php 
            echo esc_attr($elementClass);
            ?>
">
        	<?php 
            if ($title) {
                ?>
        	<h3 class="section-title"><?php 
                echo esc_html($title);
                ?>
</h3>
        	<?php 
            }
            ?>
        	<?php 
            if (!empty($terms) && !is_wp_error($terms)) {
                $count = count($terms);
                ?>
				<ul class="nav-tab tab-column-<?php 
                echo $count;
                ?>
">
                    <?php 
                $i = 0;
                foreach ($terms as $term) {
                    if ($i == 0) {
                        $class = "active";
                    } else {
                        $class = '';
                    }
                    ?>
                		<li class="<?php 
                    echo esc_attr($class);
                    ?>
"><a data-toggle="tab" href="#tab-colection-<?php 
                    echo esc_attr($term->term_id);
                    ?>
"><?php 
                    echo esc_html($term->name);
                    ?>
</a></li>
                	<?php 
                    $i++;
                }
                ?>
                </ul>
                <div class="tab-container">
                	<?php 
                $i = 0;
                foreach ($terms as $term) {
                    if ($i == 0) {
                        $class = "active";
                    } else {
                        $class = '';
                    }
                    ?>
                	<div id="tab-colection-<?php 
                    echo esc_attr($term->term_id);
                    ?>
" class="tab-panel <?php 
                    echo esc_attr($class);
                    ?>
">
                		<?php 
                    $args = array('post_type' => 'colection', 'post_status' => 'publish', 'posts_per_page' => $number, 'tax_query' => array(array('taxonomy' => 'colection_cat', 'field' => 'ID', 'terms' => $term->term_id)));
                    $colections = new WP_Query($args);
                    if ($colections->have_posts()) {
                        ?>
                        <?php 
                        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;
                            if ($colections->post_count < $items_mobile || $colections->post_count < $items_tablet || $colections->post_count < $items_destop) {
                                $data_carousel['loop'] = 'false';
                            } else {
                                $data_carousel['loop'] = $loop;
                            }
                        } else {
                            $data_carousel['items'] = 3;
                            if ($colections->post_count < 3) {
                                $data_carousel['loop'] = 'false';
                            } else {
                                $data_carousel['loop'] = $loop;
                            }
                        }
                        ?>
				        	<ul class="collection-list owl-carousel" <?php 
                        echo _data_carousel($data_carousel);
                        ?>
>
				        		<?php 
                        $i = 1;
                        while ($colections->have_posts()) {
                            $colections->the_post();
                            $_kt_page_colection_design = get_post_meta(get_the_ID(), '_kt_page_colection_design', true);
                            ?>
				        			<?php 
                            if ($i % 2) {
                                ?>
				        			<li class="item">
				        				<?php 
                                if (has_post_thumbnail()) {
                                    ?>
				        				<div class="image banner-boder-zoom2">
				        					<a href="<?php 
                                    the_permalink();
                                    ?>
"><?php 
                                    the_post_thumbnail('colection-thumb');
                                    ?>
</a>
				        				</div>
				        				<?php 
                                }
                                ?>
	
				        				<div class="info">
		                                    <h3 class="title"><a href="<?php 
                                the_permalink();
                                ?>
"><?php 
                                the_title();
                                ?>
</a></h3>
		                                    <div class="desc"><?php 
                                the_excerpt();
                                ?>
</div>
		                                    <?php 
                                if ($_kt_page_colection_design) {
                                    ?>
		                                    <div class="author"><?php 
                                    _e('Designed by', 'kutetheme');
                                    ?>
: <?php 
                                    echo esc_html($_kt_page_colection_design);
                                    ?>
</div>
		                                	<?php 
                                }
                                ?>
		                                    <div class="collection-button">
		                                        <a href="<?php 
                                the_permalink();
                                ?>
"><?php 
                                _e('View Collection', 'kutetheme');
                                ?>
</a>
		                                    </div>
		                                </div>
				        			</li>
				        			<?php 
                            } else {
                                ?>
				        			<li class="item">	
				        				<div class="info">
		                                    <h3 class="title"><a href="<?php 
                                the_permalink();
                                ?>
"><?php 
                                the_title();
                                ?>
</a></h3>
		                                    <div class="desc"><?php 
                                the_excerpt();
                                ?>
</div>
		                                    <?php 
                                if ($_kt_page_colection_design) {
                                    ?>
		                                    <div class="author"><?php 
                                    _e('Designed by', 'kutetheme');
                                    ?>
: <?php 
                                    echo esc_html($_kt_page_colection_design);
                                    ?>
</div>
		                                	<?php 
                                }
                                ?>
		                                    <div class="collection-button">
		                                        <a href="<?php 
                                the_permalink();
                                ?>
"><?php 
                                _e('View Collection', 'kutetheme');
                                ?>
</a>
		                                    </div>
		                                </div>
		                                <?php 
                                if (has_post_thumbnail()) {
                                    ?>
				        				<div class="image banner-boder-zoom2">
				        					<a href="<?php 
                                    the_permalink();
                                    ?>
"><?php 
                                    the_post_thumbnail('colection-thumb');
                                    ?>
</a>
				        				</div>
				        				<?php 
                                }
                                ?>
				        			</li>
				        			<?php 
                            }
                            ?>
				        			<?php 
                            $i++;
                        }
                        ?>
				        	</ul>
				        	<?php 
                    } else {
                        ?>
				        	<p><?php 
                        _e('No colection', 'kutetheme');
                        ?>
</p>
				        	<?php 
                    }
                    ?>
                	</div>
                	<?php 
                    $i++;
                    wp_reset_postdata();
                }
                ?>
                </div>
				<?php 
            }
            ?>
        </div>
    	<?php 
        }
        ?>
        <!-- ./Style 1 -->
        <?php 
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }
Ejemplo n.º 9
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('kt_look_books', $atts) : $atts;
        $atts = shortcode_atts(array('title' => 'LOOK BOOKS', 'sub_title' => '', 'columns' => 4, 'link_submit' => '#', 'overlay_opacity' => '0.7', 'overlay_color' => '#000000', 'el_class' => '', 'css' => '', 'autoplay' => 0, 'navigation' => 0, 'margin' => 30, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'loop' => 0, 'use_responsive' => 1, 'items_destop' => 3, 'items_tablet' => 2, 'items_mobile' => 1), $atts);
        extract($atts);
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array('section8 block-loock-bocks ', ''), implode(' ', $elementClass));
        if ($overlay_color == "") {
            $overlay_color = "#000000";
        }
        $overlay_color = kt_hex2rgb($overlay_color);
        $args = array('post_type' => 'look-books', 'post_status' => 'publish', 'posts_per_page' => $columns);
        $look_book_query = new WP_Query($args);
        $data_carousel = array("autoplay" => $autoplay == 1 ? "true" : "false", "nav" => $navigation == 1 ? "true" : "false", "margin" => $margin, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'dots' => 'false', 'loop' => $loop == 1 ? "true" : "false", '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;
            if ($look_book_query->post_count < $items_mobile || $look_book_query->post_count < $items_tablet || $look_book_query->post_count < $items_destop) {
                $data_carousel['loop'] = 'false';
            } else {
                $data_carousel['loop'] = $loop;
            }
        } else {
            $data_carousel['items'] = 3;
            if ($look_book_query->post_count < 3) {
                $data_carousel['loop'] = 'false';
            } else {
                $data_carousel['loop'] = $loop;
            }
        }
        ob_start();
        ?>
        <div class="<?php 
        echo esc_attr($elementClass);
        ?>
">
            <div class="overlay" style="background-color: rgba(<?php 
        echo esc_attr($overlay_color['red']);
        ?>
,<?php 
        echo esc_attr($overlay_color['green']);
        ?>
,<?php 
        echo esc_attr($overlay_color['blue']);
        ?>
,<?php 
        echo esc_attr($overlay_opacity);
        ?>
);"></div>
            <?php 
        if ($title) {
            ?>
            <h3 class="section-title"><?php 
            echo esc_html($title);
            ?>
</h3>
            <?php 
        }
        ?>
            <div class="container">
                <?php 
        if ($look_book_query->have_posts()) {
            ?>
                <ul class="loock-boock-list owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                    <?php 
            while ($look_book_query->have_posts()) {
                $look_book_query->the_post();
                $_kt_page_lookbook_location = get_post_meta(get_the_ID(), '_kt_page_lookbook_location', true);
                ?>
                    <li class="">
                        <?php 
                if (has_post_thumbnail()) {
                    ?>
                        <?php 
                    $full_image_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), "full");
                    ?>
                        <div class="image">
                            <a class="fancybox" href="<?php 
                    echo esc_url($full_image_src[0]);
                    ?>
"><?php 
                    the_post_thumbnail('lookbook-thumb');
                    ?>
</a>
                        </div>
                        <?php 
                }
                ?>
                        <div class="info">
                            <p class="name"><?php 
                the_title();
                ?>
</p>
                            <?php 
                if ($_kt_page_lookbook_location) {
                    ?>
                            <p class="location"><?php 
                    echo esc_html($_kt_page_lookbook_location);
                    ?>
</p>
                            <?php 
                }
                ?>
                        </div>
                    </li>
                    <?php 
            }
            ?>
                </ul>
                <div class="lock-boock-button">
                    <a href="<?php 
            echo esc_url($link_submit);
            ?>
"><?php 
            _e('Submit Your Photos', 'kutetheme');
            ?>
</a>
                    <a href="<?php 
            echo get_post_type_archive_link('look-books');
            ?>
"><?php 
            _e('View All', 'kutethme');
            ?>
</a>
                </div>
                <?php 
        } else {
            ?>
                    <p><?php 
            _e('No Look Book item.', 'kutetheme');
            ?>
</p>
                <?php 
        }
        ?>
            </div>
        </div>
        <?php 
        wp_reset_query();
        wp_reset_postdata();
        return ob_get_clean();
    }
Ejemplo n.º 10
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('brand', $atts) : $atts;
        $atts = shortcode_atts(array('taxonomy' => '', 'box_type' => 'box-1', 'per_page' => 4, 'number' => 24, 'orderby' => 'id', 'order' => 'desc', 'hide' => 1, 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 250, 'css' => '', 'css_animation' => '', 'el_class' => '', 'loop' => 'true', 'use_responsive' => 1, 'items_destop' => 4, 'items_tablet' => 2, 'items_mobile' => 1, 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        $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));
        $data_carousel = array("autoplay" => $autoplay, "nav" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', '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 {
            $data_carousel['items'] = 4;
        }
        ob_start();
        if ($taxonomy) {
            $ids = explode(',', $taxonomy);
        } else {
            $ids = array();
        }
        $arg = array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide, 'pad_counts' => true, 'number' => $number);
        if ($ids && count($ids) > 0) {
            $arg['include'] = $ids;
        }
        $brands = get_terms('product_brand', $arg);
        $count = count($brands);
        if (is_array($brands) && $brands && $count > 0) {
            if ($box_type == 'box-3') {
                ?>
            <div class="list kt-owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
            <?php 
                foreach ($brands as $brand) {
                    $brand_link = esc_attr(get_term_link($brand));
                    $thumbnail_id = absint(get_woocommerce_term_meta($brand->term_id, 'thumbnail_id', true));
                    if ($thumbnail_id) {
                        $image = wp_get_attachment_image_src($thumbnail_id, 'full');
                        if (is_array($image) && isset($image[0]) && $image[0]) {
                            $image = $image[0];
                        } else {
                            $image = wc_placeholder_img_src();
                        }
                    } else {
                        $image = wc_placeholder_img_src();
                    }
                    ?>
                <a href="<?php 
                    echo esc_url($brand_link);
                    ?>
">
                    <img src="<?php 
                    echo $image;
                    ?>
" alt="<?php 
                    echo $brand->name;
                    ?>
" />
                </a>
                <?php 
                }
                ?>
            </div>
            <?php 
            } elseif ($box_type == 'box-2') {
                $page = 1;
                if ($count % $per_page == 0) {
                    $page = $count / $per_page;
                } else {
                    $page = $count / $per_page + 1;
                }
                ?>
                <div class="option3">
                    <div class="block block-type-2 block-banner-owl kt-owl-carousel" data-margin="0"  data-nav="true" data-items="1" <?php 
                if ($page > 1) {
                    ?>
 data-loop="true" <?php 
                } else {
                    ?>
 data-loop="false" <?php 
                }
                ?>
>
        				<?php 
                for ($i = 1; $i <= $page; $i++) {
                    ?>
                        <div class="page-banner">
        					<ul class="list-banner">
                                <?php 
                    $from = ($i - 1) * $per_page;
                    $to = $i * $per_page;
                    ?>
                                <?php 
                    for ($from; $from < $to; $from++) {
                        if (isset($brands[$from]) && $brands[$from]) {
                            $brand = $brands[$from];
                            $brand_link = esc_attr(get_term_link($brand));
                            $thumbnail_id = absint(get_woocommerce_term_meta($brand->term_id, 'thumbnail_id', true));
                            if ($thumbnail_id) {
                                $image = wp_get_attachment_image_src($thumbnail_id, 'full');
                                if (is_array($image) && isset($image[0]) && $image[0]) {
                                    $image = $image[0];
                                } else {
                                    $image = wc_placeholder_img_src();
                                }
                            } else {
                                $image = wc_placeholder_img_src();
                            }
                            ?>
        						            <li><a target="_blank" href="<?php 
                            echo $brand_link;
                            ?>
"><img src="<?php 
                            echo $image;
                            ?>
" alt="<?php 
                            echo $brand->name;
                            ?>
" /></a></li>
                                        <?php 
                        }
                        ?>
                                <?php 
                    }
                    ?>
        					</ul>
        				</div>
                        <?php 
                }
                ?>
        			</div>
                </div>
            <?php 
            } else {
                ?>
            <!-- box band -->
    		<div class="box-band block3">
                <?php 
                foreach ($brands as $brand) {
                    ?>
                     <?php 
                    $brand_link = esc_attr(get_term_link($brand));
                    ?>
                     <?php 
                    $thumbnail_id = absint(get_woocommerce_term_meta($brand->term_id, 'thumbnail_id', true));
                    if ($thumbnail_id) {
                        $image = wp_get_attachment_image_src($thumbnail_id, 'full');
                        if (is_array($image) && isset($image[0]) && $image[0]) {
                            $image = $image[0];
                        } else {
                            $image = wc_placeholder_img_src();
                        }
                    } else {
                        $image = wc_placeholder_img_src();
                    }
                    ?>
    			     <a target="_blank" href="<?php 
                    echo $brand_link;
                    ?>
">
                        <img src="<?php 
                    echo $image;
                    ?>
" alt="<?php 
                    echo $brand->name;
                    ?>
" />
                    </a>
                <?php 
                }
                ?>
    		</div>
    		<!-- ./box band -->
            <?php 
            }
        } else {
            ?>
        <div class="alert alert-warning"><?php 
            _e('No Brand.', 'edo');
            ?>
</div>
        <?php 
        }
        $result = ob_get_clean();
        return $result;
    }
Ejemplo n.º 11
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();
    }
Ejemplo n.º 12
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('blog_carousel', $atts) : $atts;
        extract(shortcode_atts(array('title' => __('From the blog', 'kutetheme'), 'subtitle' => '', 'per_page' => 10, 'orderby' => 'date', 'order' => 'desc', 'color3' => '#f25f43', 'color2' => '#666666', 'color1' => '#f25f43', 'style' => '1', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 250, 'css' => '', 'css_animation' => '', 'el_class' => '', 'loop' => 'true', 'use_responsive' => 1, 'items_destop' => 4, 'items_tablet' => 2, 'items_mobile' => 1), $atts));
        global $woocommerce_loop;
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, ' style' . $style . ' ', $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));
        $data_carousel = array("autoplay" => $autoplay, "nav" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', '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 {
            $data_carousel['items'] = 4;
        }
        $args = array('post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order);
        $posts = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        ob_start();
        if ($posts->have_posts()) {
            $i = 0;
            ?>
        <?php 
            if ($style == 2) {
                ?>
        <div class="lasttest-blogs style2 <?php 
                echo esc_attr($elementClass);
                ?>
">
            <?php 
                if ($title) {
                    ?>
            <div class="head"><?php 
                    echo esc_html($title);
                    ?>
</div>
            <?php 
                }
                ?>
            <div class="box-content">
                <ul class="list  kt-owl-carousel nav-style2" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                    <?php 
                while ($posts->have_posts()) {
                    $posts->the_post();
                    $i++;
                    $item_color = "#666";
                    if ($i == 1) {
                        $item_color = $color1;
                    }
                    if ($i == 2) {
                        $item_color = $color2;
                    }
                    if ($i == 3) {
                        $item_color = $color3;
                        $i = 0;
                    }
                    ?>
                    <li style="background-color: <?php 
                    echo esc_attr($item_color);
                    ?>
;" <?php 
                    post_class('item-blog');
                    ?>
>
                        <?php 
                    if (has_post_thumbnail()) {
                        ?>
                        <div class="thumb">
                            <a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_post_thumbnail('edo_blog_lasttest');
                        ?>
</a>
                        </div>
                        <?php 
                    }
                    ?>
                        <div class="info" style="background-color: <?php 
                    echo esc_attr($item_color);
                    ?>
;">
                            <h3 class="title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h3>
                            <div class="meta">
                                <span class="author"><i class="fa fa-user"></i> <?php 
                    the_author();
                    ?>
</span>
                                <span class="comment">
                                <i class="fa fa-comment"></i> 
                                <?php 
                    comments_number(__('0 Comment', 'kutetheme'), __('1 Comment', 'kutetheme'), __('% Comments', 'kutetheme'));
                    ?>
                                </span>
                            </div>
                            <div class="desc">
                                <?php 
                    the_excerpt();
                    ?>
                            </div>
                            <a href="<?php 
                    the_permalink();
                    ?>
" class="readmore"><?php 
                    _e('Readmore', 'edo');
                    ?>
</a>
                        </div>
                    </li>
                    <?php 
                }
                ?>
                </ul>
            </div>
        </div>
        <?php 
            }
            ?>
        <?php 
            if ($style == 1) {
                ?>
        <div class="lasttest-blogs <?php 
                echo esc_attr($elementClass);
                ?>
">
            <?php 
                if ($title) {
                    ?>
            <div class="head"><?php 
                    echo esc_html($title);
                    ?>
</div>
            <?php 
                }
                ?>
            <div class="box-content">
                <ul class="list  kt-owl-carousel nav-style2" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                    <?php 
                while ($posts->have_posts()) {
                    $posts->the_post();
                    ?>
                    <li  <?php 
                    post_class('item-blog');
                    ?>
>
                        <?php 
                    if (has_post_thumbnail()) {
                        ?>
                        <div class="thumb">
                            <a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_post_thumbnail('edo_blog_lasttest');
                        ?>
</a>
                        </div>
                        <?php 
                    }
                    ?>
                        <div class="info">
                            <h3 class="title"><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h3>
                            <div class="meta">
                                <span class="author"><i class="fa fa-user"></i> <?php 
                    the_author();
                    ?>
</span>
                                <span class="comment">
                                <i class="fa fa-comment"></i> 
                                <?php 
                    comments_number(__('0 Comment', 'kutetheme'), __('1 Comment', 'kutetheme'), __('% Comments', 'kutetheme'));
                    ?>
                                </span>
                            </div>
                            <div class="desc">
                                <?php 
                    the_excerpt();
                    ?>
                            </div>
                            <a href="<?php 
                    the_permalink();
                    ?>
" class="readmore"><?php 
                    _e('Readmore', 'edo');
                    ?>
</a>
                        </div>
                    </li>
                    <?php 
                }
                ?>
                </ul>
            </div>
        </div>
        <?php 
            }
            ?>
        <?php 
        }
        wp_reset_query();
        wp_reset_postdata();
        $result = ob_get_clean();
        return $result;
    }
Ejemplo n.º 13
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('blog_carousel', $atts) : $atts;
        extract(shortcode_atts(array('title' => 'From the blog', 'per_page' => 10, 'orderby' => 'date', 'order' => 'desc', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, '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, 'blog-list ', $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));
        $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'nav' => 'true', 'dots' => 'false', 'loop' => 'false', '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 {
            $data_carousel['items'] = 4;
        }
        $args = array('post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order);
        $posts = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        ob_start();
        if ($posts->have_posts()) {
            ?>
        <!-- blog list -->
        <div class="<?php 
            echo $elementClass;
            ?>
">
            <h2 class="page-heading">
                <span class="page-heading-title"><?php 
            echo esc_html($title);
            ?>
</span>
            </h2>
            <div class="blog-list-wapper">
                <ul class="owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                    <?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                ?>
                    <li>
                        <div class="post-thumb image-hover2">
                            <a target="_blank" href="<?php 
                the_permalink();
                ?>
"><?php 
                the_post_thumbnail('268x255');
                ?>
</a>
                        </div>
                        <div class="post-desc">
                            <h5 class="post-title">
                                <a target="_blank" href="<?php 
                the_permalink();
                ?>
"><?php 
                the_title();
                ?>
</a>
                            </h5>
                            <div class="post-meta">
                                <span class="date"><?php 
                the_date();
                ?>
</span>
                                <span class="comment">
                                    <?php 
                comments_number(__('0 Comment', THEME_LANG), __('1 Comment', THEME_LANG), __('% Comments', THEME_LANG));
                ?>
                                </span>
                            </div>
                            <div class="readmore">
                                <a target="_blank" href="<?php 
                the_permalink();
                ?>
"><?php 
                _e('Readmore', THEME_LANG);
                ?>
</a>
                            </div>
                        </div>
                    </li>
                    <?php 
            }
            ?>
                </ul>
            </div>
        </div>
        <!-- ./blog list -->
        <?php 
        }
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }
Ejemplo n.º 14
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('top_seller', $atts) : $atts;
        $atts = shortcode_atts(array('title' => __('Top Sellers', 'edo'), 'icon' => '', 'per_page' => 4, 'taxonomy' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 250, 'nav' => 'true', 'loop' => 'true', 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        ob_start();
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'block block-top-sellers ', $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, 'meta_query' => $meta_query, 'suppress_filter' => true, 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num');
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        if ($products->have_posts()) {
            $new_title = trim($title);
            $new_title = explode(' ', $new_title);
            if (count($new_title) > 1) {
                $title_sm = $new_title[0];
                unset($new_title[0]);
                $title_lg = implode(' ', $new_title);
            } else {
                $title_sm = __('Top', 'edo');
                $title_lg = __('sellers', 'edo');
            }
            if (intval($icon) > 0) {
                $att_icon = wp_get_attachment_image_src($icon, array(43, 42));
                $att_icon_url = is_array($att_icon) ? esc_url($att_icon[0]) : $default_icon;
            } else {
                if (filter_var($icon, FILTER_VALIDATE_URL)) {
                    $att_icon_url = $icon;
                } else {
                    $att_icon_url = KUTETHEME_PLUGIN_URL . 'js_composer/imgs/top-seller-icon.png';
                }
            }
            // Check lopp
            if ($products->post_count <= 1) {
                $loop = 'false';
            }
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-top', "autoheight" => 'false', 'nav' => 'true', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true', 'items' => '1');
            ?>
        <!-- block  top sellers -->
		<div class="<?php 
            echo $elementClass;
            ?>
">
			<div class="block-head">
				<div class="block-title">
					<div class="block-icon">
						<img alt="<?php 
            echo $title;
            ?>
" title="<?php 
            echo $title;
            ?>
" src="<?php 
            echo $att_icon_url;
            ?>
" />
					</div>
					<div class="block-title-text text-sm"><?php 
            echo esc_html($title_sm);
            ?>
</div>
					<div class="block-title-text text-lg"><?php 
            echo esc_html($title_lg);
            ?>
</div>
				</div>
			</div>
			<div class="block-inner">
				<?php 
            do_action("woocommerce_shortcode_before_top_seller_loop");
            ?>
					<ul class="products kt-owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                        <?php 
            while ($products->have_posts()) {
                $products->the_post();
                $id = get_the_ID();
                $link = get_permalink($id);
                ?>
                            <?php 
                edo_woocommerce_product_loop_item_before();
                ?>
    							<?php 
                wc_get_template_part('content', 'list-product');
                ?>
                            <?php 
                edo_woocommerce_product_loop_item_after();
                ?>
						<?php 
            }
            ?>
					</ul>
                <?php 
            do_action("woocommerce_shortcode_after_top_seller_loop");
            ?>
			</div>
		</div>
		<!-- block  top sellers -->
        <?php 
        }
        wp_reset_postdata();
        wp_reset_query();
        $result = ob_get_clean();
        return $result;
    }
Ejemplo n.º 15
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('lastest_deal_products', $atts) : $atts;
        $atts = shortcode_atts(array('title' => '&nbsp;', 'taxonomy' => '', 'number' => 10, 'product_column' => 5, 'orderby' => 'date', 'order' => 'DESC', 'autoplay' => '', 'navigation' => '', 'margin' => 10, 'slidespeed' => 200, 'css' => '', 'el_class' => '', 'nav' => "true", 'loop' => "false", 'use_responsive' => 1, 'items_destop' => 5, 'items_tablet' => 3, 'items_mobile' => 1, 'columns' => 1), $atts);
        extract($atts);
        // Get products on sale
        $product_ids_on_sale = wc_get_product_ids_on_sale();
        $meta_query = WC()->query->get_meta_query();
        $args = array('posts_per_page' => $number, 'post_type' => 'product', 'order' => $order, 'no_found_rows' => 1, 'post_status' => 'publish', 'meta_query' => $meta_query, 'post__in' => array_merge(array(0), $product_ids_on_sale));
        $args["orderby"] = $orderby;
        if ($taxonomy) {
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => explode(",", $taxonomy)));
        }
        $q = apply_filters('woocommerce_shortcode_products_query', $args, $atts);
        $query_product = new WP_Query($q);
        global $woocommerce_loop, $post;
        $woocommerce_loop['columns'] = $columns;
        ob_start();
        if ($query_product->have_posts()) {
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "loop" => $loop, "theme" => 'style-navigation-bottom', "autoheight" => "false", 'nav' => "true", 'dots' => "false");
            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 ($product_column > 0) {
                    $data_carousel['items'] = $product_column;
                }
            }
            $elementClass = array('shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
            $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
            ?>
        <div class="<?php 
            echo esc_attr($el_class);
            ?>
">
            <?php 
            if ($title) {
                ?>
                <h2 class="page-heading">
                    <span class="page-heading-title"><?php 
                echo esc_html($title);
                ?>
</span>
                </h2>
            <?php 
            }
            ?>
            <div class="latest-deals-product container-data-time">
                <span class="count-down-time2">
                    <span class="icon-clock"></span>
                    <span><?php 
            _e('end in', 'kutetheme');
            ?>
</span>
                    <span class="countdown-lastest stick-countdown"></span>
                </span>
                <ul class="product-list owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                     <?php 
            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);
            $max = 0;
            while ($query_product->have_posts()) {
                $query_product->the_post();
                $id = get_the_ID();
                global $post;
                ?>
                            <?php 
                $time = kt_get_max_date_sale($id);
                if ($time > $max) {
                    $max = $time;
                }
                ?>
                            <li>
        					   <?php 
                wc_get_template_part('content', 'product-lastest-deal');
                ?>
                            </li>
                        <?php 
            }
            // end of the loop.
            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);
            ?>
                </ul>
                <?php 
            if ($max > 0) {
                $y = date('Y', $max);
                $m = date('m', $max);
                $d = date('d', $max);
                ?>
                        <input class="max-time" type="hidden" value="" data-y="<?php 
                echo esc_attr($y);
                ?>
" data-m="<?php 
                echo esc_attr($m);
                ?>
" data-d="<?php 
                echo esc_attr($d);
                ?>
" />
                        <?php 
            }
            ?>
            </div>
        </div>
        <?php 
        }
        wp_reset_postdata();
        wp_reset_query();
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }
Ejemplo n.º 16
0
    public function widget($args, $instance)
    {
        echo apply_filters('kt_wg_before_widget', $args['before_widget']);
        $autoplay = isset($instance['autoplay']) && $instance['autoplay'] ? "true" : "false";
        $loop = isset($instance['loop']) && $instance['loop'] ? "true" : "false";
        $slidespeed = isset($instance['slidespeed']) && intval($instance['slidespeed']) ? intval($instance['slidespeed']) : 250;
        $data_carousel = array("autoplay" => $autoplay, "slidespeed" => $slidespeed, "theme" => 'style-navigation-bottom', 'nav' => "false", 'loop' => $loop, 'items' => 1);
        if (is_array($instance['image']) && count($instance['image']) < 2) {
            $data_carousel['loop'] = false;
        }
        ?>
        <div class="col-left-slide left-module">
            <ul class="owl-carousel owl-style2" <?php 
        echo _data_carousel($data_carousel);
        ?>
>
                <?php 
        if (isset($instance['image']) && $instance['image'] && count($instance['image']) > 0) {
            for ($i = 0; $i < count($instance['image']); $i++) {
                $title = isset($instance['title'][$i]) && $instance['title'][$i] ? esc_html($instance['title'][$i]) : '';
                $image = isset($instance['image'][$i]) && intval($instance['image'][$i]) ? intval($instance['image'][$i]) : '';
                $link = isset($instance['link'][$i]) && $instance['link'][$i] ? esc_url($instance['link'][$i]) : '#';
                $link_target = isset($instance['target'][$i]) && $instance['target'][$i] ? esc_attr($instance['target'][$i]) : '_blank';
                $img_preview = "";
                if ($image) {
                    $img_preview = wp_get_attachment_image_src($image, 'full');
                    if (is_array($img_preview)) {
                        $img_preview = $img_preview[0];
                        $preview = true;
                    } else {
                        $img_preview = "";
                    }
                }
                if ($preview) {
                    ?>
                                <li>
                                    <a target="<?php 
                    echo esc_attr($link_target);
                    ?>
" title="<?php 
                    echo esc_attr($title);
                    ?>
" href="<?php 
                    echo esc_url($link);
                    ?>
">
                                    <img src="<?php 
                    echo esc_url($img_preview);
                    ?>
" alt="<?php 
                    echo esc_attr($title);
                    ?>
" /></a>
                                </li>
                            <?php 
                }
                ?>
                    <?php 
            }
            ?>
                <?php 
        }
        ?>
            </ul>
        </div>
       <?php 
        echo apply_filters('kt_wg_after_widget', $args['after_widget']);
    }
Ejemplo n.º 17
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('product_sidebar', $atts) : $atts;
        extract(shortcode_atts(array('title' => '', 'per_page' => 5, 'template' => 'template-1', 'type' => 'hot-deals', 'taxonomy' => 0, 'orderby' => 'date', 'order' => 'DESC', 'autoplay' => 'false', 'navigation' => 'false', 'slidespeed' => 250, 'nav' => 'true', 'loop' => 'true', 'css' => '', 'css_animation' => '', 'el_class' => ''), $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));
        ob_start();
        $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, 'meta_query' => $meta_query);
        if ($type == 'hot-deals') {
            $product_ids_on_sale = wc_get_product_ids_on_sale();
            $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
            if ($orderby == 'discount') {
                $newargs['meta_key'] = '_reduction_percent';
                $newargs['orderby'] = 'meta_value_num';
            } else {
                $args['orderby'] = $orderby;
            }
            $args['order'] = $order;
        } elseif ($type == 'best-selling') {
            $newargs['meta_key'] = 'total_sales';
            $newargs['orderby'] = 'meta_value_num';
        } elseif ($type == 'recent-product') {
            $args['orderby'] = $orderby;
            $args['order'] = $order;
        } elseif ($type == 'most-review') {
            add_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        }
        $cate_ids = array();
        if ($taxonomy) {
            $cate_ids = explode(",", $taxonomy);
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $cate_ids));
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        if ($products->have_posts()) {
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "slidespeed" => $slidespeed, "theme" => 'style-navigation-top', "autoheight" => 'false', 'nav' => 'true', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true', 'items' => 1);
            $unique_id = uniqid();
            $carousel = _data_carousel($data_carousel);
            if ($template == 'template-1') {
                ?>
                <div class="option3">
                    <!-- specail -->
    				<div class="block block-specail3 template-1">
    					<div class="block-head">
    						<h4 class="widget-title"><?php 
                echo $title;
                ?>
</h4>
    					</div>
    					<div class="block-inner">
    						<?php 
                do_action("woocommerce_shortcode_before_box_product_loop");
                ?>
                        		<?php 
                $this->edo_loop_product($products, $carousel, 'list-product-sidebar-1');
                ?>
                            <?php 
                do_action("woocommerce_shortcode_after_box_product_loop");
                ?>
    					</div>
    				</div>
    				<!-- ./specail -->
                </div>
                <?php 
            } elseif ($template == 'template-2') {
                ?>
                <div class="option3">
                    <!-- carousel-slide -->
                    <div class="block carousel-slide template-2">
                    	<div class="block-head">
                    		<h4 class="widget-title"><?php 
                echo $title;
                ?>
</h4>
                    	</div>
                    	<div class="block-inner">
                            <?php 
                do_action("woocommerce_shortcode_before_box_product_loop");
                ?>
                        		<?php 
                $this->edo_loop_product($products, $carousel, 'list-product-sidebar-2');
                ?>
                            <?php 
                do_action("woocommerce_shortcode_after_box_product_loop");
                ?>
                    	</div>
                    </div>
                    <!-- ./carousel-slide -->
                </div>
                <?php 
            } elseif ($template == 'template-3') {
                $i = $j = 1;
                ?>
                <div class="option3">
                    <!-- Top review -->
    				<div class="block block-top-review template-3">
    					<div class="block-head">
    						<h4 class="widget-title"><?php 
                echo $title;
                ?>
</h4>
    					</div>
    					<div class="block-inner">
    						<div class="kt-owl-carousel" <?php 
                echo $carousel;
                ?>
>
    							<?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    ?>
                                    <?php 
                    if ($i == 1) {
                        ?>
                                        <ul class="list-product">
                                    <?php 
                    }
                    ?>
                                        <li class="product <?php 
                    echo $i == 1 ? 'active' : '';
                    ?>
">
                                            <div class="product-name">
                                                <a class="product-name" href="<?php 
                    the_permalink();
                    ?>
"><span class="order"><?php 
                    echo esc_attr($j);
                    ?>
</span><?php 
                    the_title();
                    ?>
</a>
                                            </div>
                                            <?php 
                    wc_get_template_part('content', 'list-product-sidebar-3');
                    ?>
                                        </li>
                                     <?php 
                    $i++;
                    $j++;
                    ?>
                                     <?php 
                    if ($i == 6) {
                        $i = 1;
                        ?>
    	      						   </ul>
                                     <?php 
                    }
                    ?>
                                <?php 
                }
                ?>
                                <?php 
                if ($i != 1) {
                    echo '</ul>';
                }
                wp_reset_query();
                wp_reset_postdata();
                ?>
    						</div>
    					</div>
    				</div>
    				<!-- ./Top review -->
                </div>
                <?php 
            }
            if ($type == 'most-review') {
                remove_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
            }
        }
        return ob_get_clean();
    }
Ejemplo n.º 18
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('box_hot_deal', $atts) : $atts;
        extract(shortcode_atts(array('title' => __('Hot deal', 'kutetheme'), 'size' => 'kt_shop_catalog_164', 'per_page' => 5, 'taxonomy' => 0, 'orderby' => 'date', 'order' => 'DESC', 'autoplay' => 'false', 'navigation' => 'false', 'loop' => 'false', 'slidespeed' => 250, 'margin' => 0, 'css' => '', 'el_class' => '', 'nav' => 'true', 'items_destop' => 5, '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, ' option7 ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $this->product_size = $size;
        $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, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'nav' => $navigation, 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        $new_title = array(__('hot'), __('deals'));
        $charact = explode(' ', $title);
        if (is_array($charact) && count($charact) > 1) {
            $new_title = $charact;
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        ob_start();
        if ($products->have_posts()) {
            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;
                if ($products->post_count < $items_mobile || $products->post_count < $items_tablet || $products->post_count < $items_destop) {
                    $data_carousel['loop'] = 'false';
                } else {
                    $data_carousel['loop'] = $loop;
                }
            } else {
                if ($items_destop > 0) {
                    $items_destop = 5;
                }
                $data_carousel['items'] = $items_destop;
                if ($products->post_count < $items_destop) {
                    $data_carousel['loop'] = 'false';
                } else {
                    $data_carousel['loop'] = $loop;
                }
            }
            $carousel = _data_carousel($data_carousel);
            remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_price', 5);
            remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
            add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5);
            add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10);
            add_filter('kt_product_thumbnail_loop', array(&$this, 'get_size_product'));
            $max_time = 0;
            ?>
        <!-- Hot deals -->
        <div class="<?php 
            echo apply_filters('kt_class_hot_deal', $elementClass);
            ?>
">
            <div class="hot-deals-box only_countdown">
                <div class="row">
                    <div class="col-sm-12 col-md-2 col-lg-2">
                        <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">
                                <div class="box-count-down">
                                    <span class="countdown-only"></span>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-12 col-md-10 col-lg-10 hot-deals-tab-content-col">
                        <div class="hot-deals-tab-content tab-container">
                            <?php 
            do_action("woocommerce_shortcode_before_hot_deal_loop");
            ?>
                            <ul class="products owl-carousel" <?php 
            echo apply_filters('kt_hot_deal_carousel', $carousel);
            ?>
>
                                <?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
                                    <li class="product">
                    					<?php 
                wc_get_template_part('content', 'product-hotdeal');
                // 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 
            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>
        <!-- ./Hot deals -->
        <?php 
            remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5);
            remove_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10);
            add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_price', 5);
            add_action('kt_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 10);
            remove_action('kt_product_thumbnail_loop', array(&$this, 'get_size_product'));
        }
        return ob_get_clean();
    }
Ejemplo n.º 19
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('category_carousel', $atts) : $atts;
        $atts = shortcode_atts(array('title' => '', 'subtitle' => '', 'taxonomy' => '', 'banner_image' => '', 'number' => 3, 'orderby' => 'id', 'order' => 'desc', 'hide' => 0, 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 0, 'slidespeed' => 250, 'css' => '', 'css_animation' => '', 'el_class' => '', 'nav' => 'false', 'loop' => 'false', 'use_responsive' => 1, 'items_destop' => 3, 'items_tablet' => 2, 'items_mobile' => 1, 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        $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));
        ob_start();
        if ($taxonomy) {
            $ids = explode(',', $taxonomy);
        } else {
            $ids = array();
        }
        // get terms and workaround WP bug with parents/pad counts
        $args = array('orderby' => 'id', 'order' => 'desc', 'hide_empty' => 0, 'include' => $ids, 'pad_counts' => true);
        $product_categories = get_terms('product_cat', $args);
        $count_product = count($product_categories);
        $banner_url = "";
        if ($banner_image) {
            $banner = wp_get_attachment_image_src($banner_image, 'full');
            $banner_url = is_array($banner) ? esc_url($banner[0]) : '';
        }
        ?>
        <div class="hot-cat-section11 option11 parallax" style="background-image: url('<?php 
        echo apply_filters('kt_shortcode_category_carousel_bg_parallax', $banner_url ? $banner_url : '/images/paralax11.jpg');
        ?>
');">
            <div class="overlay"></div>
            <?php 
        if ($product_categories && $count_product) {
            ?>
                <?php 
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "smartSpeed" => $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;
                if ($count_product < $items_mobile || $count_product < $items_tablet || $count_product < $items_destop) {
                    $data_carousel2['loop'] = 'false';
                } else {
                    $data_carousel2['loop'] = $loop;
                }
            } else {
                if ($product_column > 0) {
                    $data_carousel['items'] = $product_column;
                }
                if ($count_product < $product_column) {
                    $data_carousel2['loop'] = 'false';
                } else {
                    $data_carousel2['loop'] = $loop;
                }
            }
            ?>
                <?php 
            if ($title) {
                ?>
                <div class="section-title-2">
                    <h2><?php 
                echo esc_html($title);
                ?>
</h2>
                    <?php 
                if ($subtitle) {
                    ?>
                    <span class="subtitle"><?php 
                    echo esc_html($subtitle);
                    ?>
</span>
                    <?php 
                }
                ?>
                </div>
            <?php 
            }
            ?>
                <div class="hot-cat-9 owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                   <?php 
            foreach ($product_categories as $term) {
                $term_link = esc_attr(get_term_link($term));
                $thumbnail_id = absint(get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true));
                ?>
                       <div class="cat-item">
                            <?php 
                if ($thumbnail_id) {
                    ?>
                                <div class="icon">
                                    <a href="<?php 
                    echo esc_url($term_link);
                    ?>
">
                                        <?php 
                    echo wp_get_attachment_image(intval($thumbnail_id), 'full', 0, array('class' => 'hot-cate-thumbnail'));
                    ?>
                                    </a>
                                </div>
                            <?php 
                }
                ?>
                            <div class="info">
                                <h3 class="cat-title">
                                    <a href="<?php 
                echo esc_url($term_link);
                ?>
">
                                        <?php 
                echo esc_html($term->name);
                ?>
                                    </a>
                                </h3>
                                <div class="desc"> <?php 
                echo esc_html($term->description);
                ?>
 </div>
                            </div>
                        </div>
                    <?php 
            }
            ?>
                </div>
            <?php 
        }
        ?>
        </div>
        <?php 
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }
Ejemplo n.º 20
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('brand', $atts) : $atts;
        $atts = shortcode_atts(array('title' => '', 'line_brand' => '1-line', 'show_product' => 'true', 'orderby' => 'date', 'order' => 'desc', 'css_animation' => '', 'el_class' => '', 'css' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 1, 'slidespeed' => 250, 'css' => '', 'css_animation' => '', 'el_class' => '', 'nav' => 'true', 'loop' => 'true', 'use_responsive' => 1, 'items_destop' => 8, 'items_tablet' => 6, 'items_mobile' => 4), $atts);
        extract($atts);
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'brand ', $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), 'css_animation' => $this->getCSSAnimation($css_animation), 'shortcode_custom' => vc_shortcode_custom_css_class($css, ' '));
        $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 {
            $data_carousel['items'] = 8;
        }
        $elementClass = preg_replace(array('/\\s+/', '/^\\s|\\s$/'), array(' ', ''), implode(' ', $elementClass));
        ob_start();
        //Set up the taxonomy object and get terms
        $tax = get_taxonomy('product_brand');
        if ($tax) {
            $terms = get_terms('product_brand', array('hide_empty' => 0, 'orderby' => $orderby, 'order' => $order));
            if (!is_wp_error($terms) && count($terms) > 0) {
                if ($show_product == "true") {
                    ?>
                    <div class="brand-showcase <?php 
                    echo esc_attr($elementClass);
                    ?>
">
                        <?php 
                    if ($title) {
                        ?>
                            <h2 class="brand-showcase-title"><?php 
                        echo esc_html($title);
                        ?>
</h2>
                        <?php 
                    }
                    ?>
                        <div class="brand-showcase-box">
                            <ul class="brand-showcase-logo owl-carousel" <?php 
                    echo _data_carousel($data_carousel);
                    ?>
>
                                <?php 
                    $i = 1;
                    ?>
                                <?php 
                    foreach ($terms as $term) {
                        ?>
                                <li data-tab="showcase-<?php 
                        echo esc_attr($term->term_id);
                        ?>
" class="item<?php 
                        echo $i == 1 ? ' active' : '';
                        ?>
">
                                    <h3><?php 
                        echo esc_html($term->name);
                        ?>
</h3>
                                </li>
                                <?php 
                        $i++;
                        ?>
                                <?php 
                    }
                    ?>
                            </ul>
                            <div class="brand-showcase-content">
                                <?php 
                    $i = 1;
                    ?>
                                <?php 
                    //add_filter( 'kt_template_loop_product_thumbnail_size', array( $this, 'kt_thumbnail_size' ) );
                    ?>
                                <?php 
                    foreach ($terms as $term) {
                        ?>
                                    <div class="brand-showcase-content-tab<?php 
                        echo $i == 1 ? ' active' : '';
                        ?>
" id="showcase-<?php 
                        echo esc_attr($term->term_id);
                        ?>
">
                                        <?php 
                        $term_link = get_term_link($term);
                        $thumbnail_id = absint(get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true));
                        if ($thumbnail_id) {
                            $image = wp_get_attachment_image(intval($thumbnail_id), 'full');
                        } else {
                            $image = "";
                        }
                        $meta_query = WC()->query->get_meta_query();
                        $args = array('post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => 4, 'meta_query' => $meta_query, 'suppress_filter' => true, 'tax_query' => array(array('taxonomy' => 'product_brand', 'field' => 'id', 'terms' => $term->term_id, 'operator' => 'IN')));
                        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
                        if ($products->have_posts()) {
                            ?>
                                        <div class="row">
                                            <div class="col-xs-12 col-sm-4 trademark-info">
                                                <?php 
                            if ($image) {
                                ?>
                                                <div class="trademark-logo">
                                                    <a href="<?php 
                                echo esc_url($term_link);
                                ?>
">
                                                        <?php 
                                echo apply_filters('kt_brand_image_' . $term->slug, $image);
                                ?>
                                                    </a>
                                                </div>
                                                <?php 
                            }
                            ?>
                                                <div class="trademark-desc">
                                                    <?php 
                            echo esc_html($term->description);
                            ?>
                                                </div>
                                                <a href="<?php 
                            echo esc_url($term_link);
                            ?>
" class="trademark-link"><?php 
                            _e('shop this brand', 'kutetheme');
                            ?>
</a>
                                            </div>
                                            <div class="col-xs-12 col-sm-8 trademark-product">
                                                <div class="row">
                                                    <?php 
                            while ($products->have_posts()) {
                                $products->the_post();
                                $link = get_the_permalink();
                                ?>
                                                    <div class="col-xs-12 col-sm-6 product-item">
                                                        <div class="image-product hover-zoom">
                                                            <a href="<?php 
                                echo esc_url($link);
                                ?>
">
                                                                <?php 
                                /**
                                 * kt_loop_product_thumbnail hook
                                 *
                                 * @hooked woocommerce_template_loop_product_thumbnail - 10
                                 */
                                echo woocommerce_get_product_thumbnail();
                                ?>
                                                            </a>
                                                        </div>
                                                        <div class="info-product">
                                                            <a href="<?php 
                                echo esc_url($link);
                                ?>
">
                                                                <h5><?php 
                                echo esc_html(get_the_title());
                                ?>
</h5>
                                                            </a>
                                                            <div class="content_price">
                                                                <?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>
                                                            <a class="btn-view-more" title="<?php 
                                _e('View More', 'kutetheme');
                                ?>
" href="<?php 
                                echo esc_url($link);
                                ?>
"><?php 
                                _e('View More', 'kutetheme');
                                ?>
</a>
                                                        </div>
                                                    </div>
                                                    <?php 
                            }
                            ?>
                                                </div>
                                            </div>
                                        </div>
                                        <?php 
                        }
                        ?>
                                        <?php 
                        wp_reset_query();
                        ?>
                                        <?php 
                        wp_reset_postdata();
                        ?>
                                    </div>
                                <?php 
                        $i++;
                        ?>
                                <?php 
                    }
                    ?>
                                <?php 
                    //remove_filter( 'kt_template_loop_product_thumbnail_size', array( $this, 'kt_thumbnail_size' ) );
                    ?>
                            </div>
                        </div>
                    </div>
                    <?php 
                } else {
                    ?>
                        <?php 
                    if ($line_brand == '2-line') {
                        ?>
                            <div class="option7">
                                <!-- ./blog list -->
                                <div class="row-brand <?php 
                        echo esc_attr($elementClass);
                        ?>
">
                                    <?php 
                        if ($title) {
                            ?>
                                        <h2 class="page-heading">
                                            <span class="page-heading-title"><?php 
                            echo esc_html($title);
                            ?>
</span>
                                        </h2>
                                    <?php 
                        }
                        ?>
                                    <ul class="band-logo no-product owl-carousel" <?php 
                        echo _data_carousel($data_carousel);
                        ?>
>
                                        <?php 
                        for ($i = 0; $i < count($terms); $i += 2) {
                            ?>
                                            <?php 
                            if (isset($terms[$i]) && $terms[$i]) {
                                ?>
                                                <?php 
                                $term = $terms[$i];
                                ?>
                                                <li>
                                                    <h3><?php 
                                echo esc_html($term->name);
                                ?>
</h3>
                                                    <?php 
                                if (isset($terms[$i + 1]) && $terms[$i + 1]) {
                                    ?>
                                                        <?php 
                                    $term_2 = $terms[$i + 1];
                                    ?>
                                                        <h3><?php 
                                    echo esc_html($term_2->name);
                                    ?>
</h3>
                                                    <?php 
                                }
                                ?>
                                                </li>
                                            <?php 
                            }
                            ?>
                                        <?php 
                        }
                        ?>
                                    </ul>
                                </div>
                                <!-- ./blog list -->
                            </div>
                        <?php 
                    } else {
                        ?>
                            <div class="<?php 
                        echo esc_attr($elementClass);
                        ?>
 band-logo no-product owl-carousel" <?php 
                        echo _data_carousel($data_carousel);
                        ?>
>
                                <?php 
                        foreach ($terms as $term) {
                            ?>
                                    <h3><?php 
                            echo esc_html($term->name);
                            ?>
</h3>
                                <?php 
                        }
                        ?>
                            </div>
                        <?php 
                    }
                    ?>
                    <?php 
                }
            }
        }
        $result = ob_get_contents();
        ob_end_clean();
        return $result;
    }
Ejemplo n.º 21
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('popular_category', $atts) : $atts;
        $atts = shortcode_atts(array('title' => __('Popular categories', 'edo'), 'type' => 'type-1', 'taxonomy' => '', 'number' => 5, 'orderby2' => 'date', 'orderby' => 'id', 'order' => 'desc', 'hide' => 1, 'autoplay' => 'false', 'loop' => 'false', 'margin' => 0, 'slidespeed' => 250, 'items_destop' => 3, 'items_tablet' => 2, 'items_mobile' => 1, 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        $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));
        ob_start();
        if ($taxonomy) {
            $ids = explode(',', $taxonomy);
        } else {
            $ids = array();
        }
        $data_carousel = array("autoplay" => $autoplay, "navigation" => 'false', "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-center', "autoheight" => 'false', 'nav' => 'true', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        $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;
        if ($type == 'type-1') {
            $arg_child = array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide, 'pad_counts' => true, 'number' => $number);
            ?>
        <!-- block-popular-cat-->
		<div class="block-popular-cat <?php 
            echo $elementClass;
            ?>
">
            <?php 
            if ($title) {
                ?>
    			<h3 class="title">
    				<span class="text"><?php 
                echo $title;
                ?>
</span>
    			</h3>
            <?php 
            }
            ?>
			<div class="popular-inner">
				<div class="list-popular-cat kt-owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
					<?php 
            if ($ids && count($ids) > 0) {
                foreach ($ids as $id) {
                    $term = get_term($id, 'product_cat');
                    if ($term) {
                        $arg_child['parent'] = $term->term_id;
                        $thumbnail_id = absint(get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true));
                        if ($thumbnail_id) {
                            $image = wp_get_attachment_image_src($thumbnail_id, 'full');
                            if (is_array($image) && isset($image[0]) && $image[0]) {
                                $image = $image[0];
                            } else {
                                $image = wc_placeholder_img_src();
                            }
                        } else {
                            $image = wc_placeholder_img_src();
                        }
                        $children = get_terms('product_cat', $arg_child);
                        ?>
                            <div class="item">
        						<div class="image">
        							<img src="<?php 
                        echo esc_url($image);
                        ?>
" alt="<?php 
                        echo esc_attr($term->name);
                        ?>
" />
        						</div>
        						<div class="inner">
        							<h5 class="parent-categories"><?php 
                        echo esc_html($term->name);
                        ?>
</h5>
                                    <?php 
                        if (count($children) > 0) {
                            ?>
            							<ul class="sub-categories">
            								<?php 
                            foreach ($children as $child) {
                                ?>
                                                <?php 
                                $chil_link = get_term_link($child);
                                ?>
                                                <li>
                                                    <a href="<?php 
                                echo esc_url($chil_link);
                                ?>
"><?php 
                                echo esc_html($child->name);
                                ?>
</a>
                                                </li>
                                            <?php 
                            }
                            ?>
            							</ul>
                                    <?php 
                        }
                        ?>
        						</div>
        					</div>
                        <?php 
                    }
                    ?>
                    <?php 
                }
                ?>
                    <?php 
            }
            ?>
               
				</div>
			</div>
		</div>
		<!-- ./block-popular-cat-->
        <?php 
        } elseif ($type == 'type-2') {
            ?>
        <div class="block-popular-cat2 <?php 
            echo $elementClass;
            ?>
">
            <h3 class="title"><?php 
            echo $title;
            ?>
</h3>
            <?php 
            if ($ids && count($ids) > 0) {
                $i = 1;
                foreach ($ids as $id) {
                    $term = get_term($id, 'product_cat');
                    if ($term) {
                        $arg_child['parent'] = $term->term_id;
                        $children = get_terms('product_cat', $arg_child);
                        if ($children) {
                            ?>
                            <div class="block block-popular-cat2-item box<?php 
                            echo $i;
                            ?>
 block-<?php 
                            echo esc_attr($term->slug);
                            ?>
">
                                <div class="block-inner">
                                    <div class="cat-name"><?php 
                            echo esc_html($term->name);
                            ?>
</div>
                                    <div class="box-subcat">
                                        <ul class="list-subcat kt-owl-carousel" <?php 
                            echo _data_carousel($data_carousel);
                            ?>
>
                                            <?php 
                            foreach ($children as $child) {
                                ?>
                                                <?php 
                                $child_link = get_term_link($child);
                                $thumbnail_id = absint(get_woocommerce_term_meta($child->term_id, 'thumbnail_id', true));
                                if ($thumbnail_id) {
                                    $image = wp_get_attachment_image_src($thumbnail_id, 'full');
                                    if (is_array($image) && isset($image[0]) && $image[0]) {
                                        $image = $image[0];
                                    } else {
                                        $image = wc_placeholder_img_src();
                                    }
                                } else {
                                    $image = wc_placeholder_img_src();
                                }
                                ?>
                                                <li class="item">
                                                    <a href="<?php 
                                echo esc_url($child_link);
                                ?>
">
                                                        <img src="<?php 
                                echo esc_url($image);
                                ?>
" alt="<?php 
                                echo esc_attr($child->name);
                                ?>
" />
                                                    </a>
                                                </li>
                                            <?php 
                            }
                            ?>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        <?php 
                            $i++;
                        }
                        ?>
                    <?php 
                    }
                    ?>
                <?php 
                }
                ?>
            <?php 
            }
            ?>
        </div>
        <?php 
        } else {
            ?>
        <div class="option4">
            <!-- block categories -->
			<div class="block-categories block-categories-4 kt-owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
				<?php 
            if ($ids && count($ids) > 0) {
                $arg_child = array('orderby' => $orderby, 'order' => $order, 'hide_empty' => $hide, 'pad_counts' => true, 'number' => $number);
                foreach ($ids as $id) {
                    $term = get_term($id, 'product_cat');
                    if ($term) {
                        $arg_child['parent'] = $term->term_id;
                        $term_link = get_term_link($term);
                        $thumbnail_id = absint(get_woocommerce_term_meta($term->term_id, 'thumbnail_id', true));
                        if ($thumbnail_id) {
                            $image = wp_get_attachment_image_src($thumbnail_id, 'full');
                            if (is_array($image) && isset($image[0]) && $image[0]) {
                                $image = $image[0];
                            } else {
                                $image = wc_placeholder_img_src();
                            }
                        } else {
                            $image = wc_placeholder_img_src();
                        }
                        $children = get_terms('product_cat', $arg_child);
                        ?>
                            <div class="block3 parent">
            					<div class="block-head">
            						<a href="<?php 
                        echo esc_url($term_link);
                        ?>
"><?php 
                        echo esc_html($term->name);
                        ?>
</a>
            					</div>
            					<div class="block-inner">
            						<a href="<?php 
                        echo esc_url($term_link);
                        ?>
"><img src="<?php 
                        echo esc_url($image);
                        ?>
" alt="<?php 
                        echo esc_attr($term->name);
                        ?>
" /></a>
                                    <?php 
                        if (count($children) > 0) {
                            ?>
                                        <div class="sub-cat">
                							<ul>
                								<?php 
                            foreach ($children as $child) {
                                ?>
                                                    <?php 
                                $chil_link = get_term_link($child);
                                ?>
                                                    <li>
                                                        <a href="<?php 
                                echo esc_url($chil_link);
                                ?>
"><?php 
                                echo esc_html($child->name);
                                ?>
</a>
                                                    </li>
                                                <?php 
                            }
                            ?>
                							</ul>
                						</div>
                                    <?php 
                        }
                        ?>
            					</div>
            				</div><!-- block3 -->
                        <?php 
                    }
                    ?>
                    <?php 
                }
                ?>
                <?php 
            }
            ?>
			</div>
			<!-- ./block categories -->
        </div>
        <?php 
        }
        $result = ob_get_clean();
        return $result;
    }
Ejemplo n.º 22
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;
    }
Ejemplo n.º 23
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('box_products', $atts) : $atts;
        extract(shortcode_atts(array('title' => __('hot deals', 'edo'), 'icon' => '', 'per_page' => 5, 'box_type' => 'box-1', 'type' => 'hot-deals', 'taxonomy' => 0, 'orderby' => 'date', 'order' => 'DESC', 'box_position' => 'left', 'per_child' => 8, 'sub_orderby' => 'id', 'sub_order' => 'desc', 'sub_hide' => false, 'link' => '', 'banner' => '', 'link_banner' => '', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 20, 'slidespeed' => 250, 'nav' => 'true', 'loop' => 'true', 'use_responsive' => 1, 'items_destop' => 5, 'items_tablet' => 3, 'items_mobile' => 1, 'css' => '', 'css_animation' => '', 'el_class' => ''), $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));
        ob_start();
        $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, 'meta_query' => $meta_query);
        if ($type == 'hot-deals') {
            $product_ids_on_sale = wc_get_product_ids_on_sale();
            $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
            if ($orderby == 'discount') {
                $newargs['meta_key'] = '_reduction_percent';
                $newargs['orderby'] = 'meta_value_num';
            } else {
                $args['orderby'] = $orderby;
            }
            $args['order'] = $order;
        } elseif ($type == 'best-selling') {
            $newargs['meta_key'] = 'total_sales';
            $newargs['orderby'] = 'meta_value_num';
        } elseif ($type == 'recent-product') {
            $args['orderby'] = $orderby;
            $args['order'] = $order;
        } elseif ($type == 'most-review') {
            add_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        }
        $cate_ids = array();
        if ($taxonomy) {
            $cate_ids = explode(",", $taxonomy);
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $cate_ids));
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        if ($products->have_posts()) {
            $new_title = $title;
            $new_title = explode(' ', $new_title);
            if (count($new_title) > 1) {
                $title_sm = $new_title[0];
                unset($new_title[0]);
                $title_lg = implode(' ', $new_title);
            } else {
                $title_sm = __('box', 'edo');
                $title_lg = __('title', 'edo');
            }
            $default_icon = KUTETHEME_PLUGIN_URL . 'js_composer/imgs/offers-icon.png';
            if (isset($icon) && $icon) {
                $att_icon = wp_get_attachment_image_src($icon, array(37, 43));
                $att_icon_url = is_array($att_icon) ? esc_url($att_icon[0]) : $default_icon;
            } else {
                $att_icon_url = $default_icon;
            }
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-top', "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 {
                $data_carousel['items'] = $items_destop;
            }
            $unique_id = uniqid();
            $carousel = _data_carousel($data_carousel);
            $arg_child = array('orderby' => $sub_orderby, 'order' => $sub_order, 'hide_empty' => $sub_hide, 'pad_counts' => true, 'number' => $per_child);
            if ($box_type == 'box-1') {
                ?>
                <!-- block  host deals -->
                <div class="block block-hot-deals box-1 has_countdown only_countdown">
                	<div class="block-head">
                		<div class="block-title">
                			<div class="block-icon">
                				<img alt="<?php 
                echo esc_attr($title);
                ?>
" title="<?php 
                echo esc_attr($title);
                ?>
" src="<?php 
                echo esc_url($att_icon_url);
                ?>
" />
                			</div>
                			<div class="block-title-text text-sm"><?php 
                echo esc_html($title_sm);
                ?>
</div>
                			<div class="block-title-text text-lg"><?php 
                echo esc_html($title_lg);
                ?>
</div>
                		</div>
                		<div class="block-countdownt">
                			<span class="countdown-only"></span>
                		</div>
                	</div>
                	<div class="block-inner box-type-1">
                        <?php 
                do_action("woocommerce_shortcode_before_box_product_loop");
                ?>
                    		<?php 
                $this->edo_loop_product($products, $carousel, 'list-product', true);
                ?>
                        <?php 
                do_action("woocommerce_shortcode_after_box_product_loop");
                ?>
                	</div>
                </div>
                <!-- ./block hot deals -->
                <?php 
            } elseif ($box_type == 'box-2') {
                $cate_obj = array();
                ?>
                <!-- block tabs -->
				<div class="block block-tabs box-2">
					<div class="block-head">
						<div class="block-title">
							<div class="block-title-text text-lg"><?php 
                echo esc_html($title);
                ?>
</div>
						</div>
						<ul class="nav-tab">                                   
	                        <li class="active"><a data-toggle="tab" href="#tab-all-<?php 
                echo $unique_id;
                ?>
"><?php 
                _e('All', 'edo');
                ?>
</a></li>
	                        <?php 
                if (count($cate_ids)) {
                    ?>
                                <?php 
                    foreach ($cate_ids as $id) {
                        ?>
                                    <?php 
                        $term = get_term($id, 'product_cat');
                        $cate_obj[] = $term;
                        ?>
                                    <li><a data-toggle="tab" href="#tab-<?php 
                        echo esc_attr($term->term_id . '-' . $unique_id);
                        ?>
"><?php 
                        echo esc_html($term->name);
                        ?>
</a></li>
                                <?php 
                    }
                    ?>
                            <?php 
                }
                ?>
                      	</ul>
					</div>
					<div class="block-inner">
						<div class="tab-container">
							<div id="tab-all-<?php 
                echo esc_attr($unique_id);
                ?>
" class="tab-panel active">
								<?php 
                do_action("woocommerce_shortcode_before_box_product_loop");
                ?>
                                    <?php 
                $this->edo_loop_product($products, $carousel);
                ?>
                                <?php 
                do_action("woocommerce_shortcode_after_box_product_loop");
                ?>
							</div>
                            <?php 
                if (count($cate_obj) > 0) {
                    ?>
                                <?php 
                    foreach ($cate_obj as $term) {
                        $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $term->term_id));
                        $term_products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
                        if ($term_products->have_posts()) {
                            ?>
        							<div id="tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
" class="tab-panel">
        								<?php 
                            do_action("woocommerce_shortcode_before_box_product_loop");
                            ?>
                                            <?php 
                            $this->edo_loop_product($products, $carousel);
                            ?>
                                        <?php 
                            do_action("woocommerce_shortcode_after_box_product_loop");
                            ?>
        							</div>
                                    <?php 
                        } else {
                            ?>
                                        <div id="tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
" class="tab-panel">
                                            <?php 
                            $this->edo_tab_empty();
                            ?>
                                        </div>
                                    <?php 
                        }
                        ?>
                                <?php 
                    }
                    ?>
                            <?php 
                }
                ?>
						</div>
					</div>
				</div>
				<!-- ./block tabs -->
                <?php 
            } elseif ($box_type == 'box-3' || $box_type == 'box-6') {
                $cate_obj = array();
                ?>
                <!-- new-arrivals -->
                <?php 
                if ($box_type == 'box-3') {
                    ?>
                <div class="option3">
					<div class="block3 block-new-arrivals box-3">
                <?php 
                } else {
                    ?>
                <div class="option4">
					<div class="block3 block-new-arrivals box-6">
                <?php 
                }
                ?>
						<div class="block-head">
							<h3 class="block-title"><?php 
                echo $title;
                ?>
</h3>
							<ul class="nav-tab default">
                                <?php 
                if (count($cate_ids)) {
                    ?>
                                    <?php 
                    foreach ($cate_ids as $id) {
                        ?>
                                        <?php 
                        $term = get_term($id, 'product_cat');
                        if ($term) {
                            $cate_obj[] = $term;
                            ?>
                                            <li <?php 
                            if (count($cate_obj) == 1) {
                                ?>
class="active"<?php 
                            }
                            ?>
 ><a data-toggle="tab" href="#tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
"><?php 
                            echo $term->name;
                            ?>
</a></li>
                                        <?php 
                        }
                        ?>
                                    <?php 
                    }
                    ?>
                                <?php 
                }
                ?>
	                      	</ul>
						</div>
						<div class="block-inner controls-top-left">
							<div class="tab-container">
								<?php 
                if (count($cate_obj) > 0) {
                    $i = 1;
                    ?>
                                    <?php 
                    foreach ($cate_obj as $term) {
                        $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $term->term_id));
                        $term_products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
                        if ($term_products->have_posts()) {
                            ?>
                    							<div id="tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
" class="tab-panel <?php 
                            echo $i == 1 ? 'active' : '';
                            ?>
">
                    								<?php 
                            do_action("woocommerce_shortcode_before_box_product_loop");
                            ?>
                                                        <?php 
                            $this->edo_loop_product($term_products, $carousel, 'list-product-3');
                            ?>
                                                    <?php 
                            do_action("woocommerce_shortcode_after_box_product_loop");
                            ?>
                    							</div>
                                            <?php 
                        } else {
                            ?>
                                                <div id="tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
" class="tab-panel <?php 
                            echo $i == 1 ? 'active' : '';
                            ?>
">
                                                    <?php 
                            $this->edo_tab_empty();
                            ?>
                                                </div>
                                            <?php 
                        }
                        ?>
                                        <?php 
                        $i++;
                        ?>
                                    <?php 
                    }
                    ?>
                                <?php 
                }
                ?>
							</div>
						</div>
                        <?php 
                if (isset($banner) && $banner) {
                    $banner_url = wp_get_attachment_image_src($banner, 'full');
                    $banner_src = is_array($banner_url) ? esc_url($banner_url[0]) : '';
                    if ($banner_src) {
                        ?>
        						<div class="block-footer">
        							<div class="text-center banner-hover">
        								<a href="<?php 
                        echo $link_banner;
                        ?>
"><img src="<?php 
                        echo $banner_src;
                        ?>
" alt="<?php 
                        echo $title;
                        ?>
" /></a>
        							</div>
        						</div>
                            <?php 
                    }
                    ?>
                        <?php 
                }
                ?>
					</div>
                </div>
				<!-- new-arrivals -->
                <?php 
            } elseif ($box_type == 'box-4' || $box_type == 'box-7') {
                ?>
                <!-- Hot deals -->
                <?php 
                if ($box_type == 'box-4') {
                    ?>
                <div class="option3">
					<div class="block3 block-hotdeals box-4">
                <?php 
                } else {
                    ?>
                <div class="option4">
					<div class="block3 block-hotdeals box-7">
                <?php 
                }
                ?>
						<div class="block-head">
                            <?php 
                if ($title) {
                    ?>
							<h3 class="block-title"><?php 
                    echo $title;
                    ?>
</h3>
                            <?php 
                }
                ?>
                            <?php 
                if ($link) {
                    ?>
                                <a class="link-all" href="<?php 
                    echo esc_url($link);
                    ?>
"><?php 
                    _e('View All', 'edo');
                    ?>
</a>
                            <?php 
                }
                ?>
						</div>
						<div class="block-inner controls-top-left">
							<?php 
                do_action("woocommerce_shortcode_before_box_product_loop");
                ?>
                        		<?php 
                $this->edo_loop_product($products, $carousel, 'list-product-4');
                ?>
                            <?php 
                do_action("woocommerce_shortcode_after_box_product_loop");
                ?>
						</div>
					</div>
                </div><!-- Hot deals -->
                <?php 
            } elseif ($box_type == 'box-5') {
                $cate_obj = array();
                ?>
                <div class="option3">
                    <!-- ./group banner -->
    				<div class="block3 tab-cat-products box-5">
    					<div class="block-head">
    						<ul class="nav-tab tab-category">             
    	                        <?php 
                if (count($cate_ids)) {
                    ?>
                                    <?php 
                    foreach ($cate_ids as $id) {
                        ?>
                                        <?php 
                        $term = get_term($id, 'product_cat');
                        if ($term) {
                            $cate_obj[] = $term;
                            ?>
                                            <li <?php 
                            if (count($cate_obj) == 1) {
                                ?>
class="active"<?php 
                            }
                            ?>
 ><a data-toggle="tab" href="#tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
"><?php 
                            echo $term->name;
                            ?>
</a></li>
                                        <?php 
                        }
                        ?>
                                    <?php 
                    }
                    ?>
                                <?php 
                }
                ?>
                          	</ul>
    					</div>
    					<div class="block-inner">
    						<div class="tab-container">
    							<?php 
                if (count($cate_obj) > 0) {
                    $i = 1;
                    ?>
                                        <?php 
                    foreach ($cate_obj as $term) {
                        $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $term->term_id));
                        $term_products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
                        if ($term_products->have_posts()) {
                            $arg_child['parent'] = $term->term_id;
                            $children = get_terms('product_cat', $arg_child);
                            ?>
                        							<div id="tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
" class="tab-panel <?php 
                            echo $i == 1 ? 'active' : '';
                            ?>
">
                        								<?php 
                            if (count($children) > 0) {
                                ?>
                                                            <div class="sub-cat">
                                    							<ul class="sub-categories">
                                    								<?php 
                                foreach ($children as $child) {
                                    ?>
                                                                        <?php 
                                    $chil_link = esc_attr(get_term_link($child));
                                    ?>
                                                                        <li>
                                                                            <a href="<?php 
                                    echo esc_attr($chil_link);
                                    ?>
"><?php 
                                    echo $child->name;
                                    ?>
</a>
                                                                        </li>
                                                                    <?php 
                                }
                                ?>
                                    							</ul>
                        								    </div>
                                                        <?php 
                            } else {
                                if ($use_responsive) {
                                    $arr = array('0' => array("items" => $items_mobile), '768' => array("items" => $items_tablet), '992' => array("items" => $items_destop + 1));
                                    $data_responsive = json_encode($arr);
                                    $data_carousel["responsive"] = $data_responsive;
                                } else {
                                    $data_carousel['items'] = $items_destop + 1;
                                }
                                $carousel = _data_carousel($data_carousel);
                                ?>
                                                        <?php 
                            }
                            ?>
                        								<div class="cat-product <?php 
                            echo count($children) > 0 ? 'has_subcate' : 'hasnt_subcate';
                            ?>
">
                        									<?php 
                            do_action("woocommerce_shortcode_before_box_product_loop");
                            ?>
                                                        		<?php 
                            $this->edo_loop_product($products, $carousel, 'list-product-3');
                            ?>
                                                            <?php 
                            do_action("woocommerce_shortcode_after_box_product_loop");
                            ?>
                        								</div>
        							             </div>
                                                 <?php 
                        } else {
                            ?>
                                                    <div id="tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
" class="tab-panel <?php 
                            echo $i == 1 ? 'active' : '';
                            ?>
">
                                                        <?php 
                            $this->edo_tab_empty();
                            ?>
                                                    </div>
                                                <?php 
                        }
                        ?>
                                            <?php 
                        $i++;
                        ?>
                                        <?php 
                    }
                    ?>
                                    <?php 
                }
                ?>
        						</div>
        					</div>
        				</div>
                    </div>
                <!-- ./end group banner -->
            <?php 
            } elseif ($box_type == 'box-8') {
                ?>
                <div class="box-product-style8 <?php 
                echo esc_attr($box_position);
                ?>
 <?php 
                echo esc_attr($elementClass);
                ?>
">
                    <div class="box-head">
                        <div class="inner">
                            <?php 
                if ($title) {
                    ?>
                            <span class="text"><?php 
                    echo esc_html($title);
                    ?>
</span>
                            <?php 
                }
                ?>
                        </div>
                    </div>
                    <div class="box-content">
                        <div class="box-tab">
                            <ul class="nav-tab default">
                                <?php 
                if (isset($cate_ids) && count($cate_ids)) {
                    ?>
                                    <?php 
                    foreach ($cate_ids as $id) {
                        ?>
                                        <?php 
                        $term = get_term($id, 'product_cat');
                        if ($term) {
                            $cate_obj[] = $term;
                            ?>
                                            <li <?php 
                            if (count($cate_obj) == 1) {
                                ?>
class="active"<?php 
                            }
                            ?>
 ><a data-toggle="tab" href="#tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
"><?php 
                            echo $term->name;
                            ?>
</a></li>
                                        <?php 
                        }
                        ?>
                                    <?php 
                    }
                    ?>
                                <?php 
                }
                ?>
                            </ul>
                        </div>
                        <div class="tab-container">
                            <?php 
                if (isset($cate_obj) && count($cate_obj) > 0) {
                    $i = 1;
                    ?>
                                <?php 
                    foreach ($cate_obj as $term) {
                        $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $term->term_id));
                        $term_products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
                        if ($term_products->have_posts()) {
                            ?>
                                            <div id="tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
" class="tab-panel <?php 
                            echo $i == 1 ? 'active' : '';
                            ?>
">
                                                <?php 
                            do_action("woocommerce_shortcode_before_box_product_loop");
                            ?>
                                                    <ul class="products kt-owl-carousel nav-style2" <?php 
                            echo $carousel;
                            ?>
>
                                                        <?php 
                            while ($products->have_posts()) {
                                $products->the_post();
                                ?>
                                                            <li class="product style5">
                                                                <?php 
                                wc_get_template_part('content', 'list-product-5');
                                ?>
                                                            </li>
                                                        <?php 
                            }
                            ?>
                                                    </ul>
                                                <?php 
                            do_action("woocommerce_shortcode_after_box_product_loop");
                            ?>
                                            </div>
                                        <?php 
                        } else {
                            ?>
                                            <div id="tab-<?php 
                            echo $term->term_id . '-' . $unique_id;
                            ?>
" class="tab-panel <?php 
                            echo $i == 1 ? 'active' : '';
                            ?>
">
                                                <?php 
                            $this->edo_tab_empty();
                            ?>
                                            </div>
                                        <?php 
                        }
                        ?>
                                    <?php 
                        $i++;
                        ?>
                                <?php 
                    }
                    ?>
                            <?php 
                }
                ?>
                        </div>
                        <div class="box-link">
                            <a href="<?php 
                echo esc_url($link);
                ?>
"><?php 
                _e('View all products', 'edo');
                ?>
</a>
                        </div>
                    </div>
                </div>
                <?php 
            }
            if ($type == 'most-review') {
                remove_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
            }
        }
        return ob_get_clean();
    }
Ejemplo n.º 24
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('blog_carousel', $atts) : $atts;
        extract(shortcode_atts(array('title' => __('From the blog', 'kutetheme'), 'subtitle' => '', 'per_page' => 10, 'orderby' => 'date', 'order' => 'desc', 'style' => 'style-1', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 250, 'css' => '', 'css_animation' => '', 'el_class' => '', 'loop' => 'true', 'use_responsive' => 1, 'items_destop' => 4, 'items_tablet' => 2, 'items_mobile' => 1), $atts));
        global $woocommerce_loop;
        $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));
        $data_carousel = array("autoplay" => $autoplay, "nav" => $navigation, "margin" => $margin, "smartSpeed" => $slidespeed, "theme" => 'style-navigation-bottom', "autoheight" => 'false', 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
        $args = array('post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => $per_page, 'suppress_filter' => true, 'orderby' => $orderby, 'order' => $order);
        $posts = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        $temping_post_thumbnail = KUTETHEME_PLUGIN_URL . 'js_composer/assets/imgs/post-thumbnail.png';
        ob_start();
        if ($posts->have_posts()) {
            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;
                if ($posts->post_count < $items_mobile || $posts->post_count < $items_tablet || $posts->post_count < $items_destop) {
                    $data_carousel['loop'] = 'false';
                }
            } else {
                $data_carousel['items'] = 4;
                if ($posts->post_count < 4) {
                    $data_carousel['loop'] = 'false';
                } else {
                    $data_carousel['loop'] = $loop;
                }
            }
            if ($style == 'style-2') {
                ?>
            <div class="option7">
                <!-- ./box product diltal -->
                <div class="row-blog <?php 
                echo esc_attr($elementClass);
                ?>
">
                    <!-- blog list -->
                    <div class="blog-list">
                        <h2 class="page-heading">
                            <span class="page-heading-title"><?php 
                echo esc_html($title);
                ?>
</span>
                        </h2>
                        <div class="blog-list-wapper">
                            <ul class="owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                                <?php 
                add_filter('excerpt_length', 'kt_custom_blog_excerpt_length');
                ?>
                                <?php 
                while ($posts->have_posts()) {
                    $posts->the_post();
                    ?>
                                    <li>
                                        <?php 
                    if (has_post_thumbnail()) {
                        ?>
                                            <div class="post-thumb image-hover2">
                                                <a href="<?php 
                        the_permalink();
                        ?>
">
                                                    <?php 
                        $thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), "kt_post_blog_268x255");
                        if ($thumbnail_src) {
                            ?>
                                                        <img width="<?php 
                            echo esc_attr($thumbnail_src[1]);
                            ?>
" height="<?php 
                            echo esc_attr($thumbnail_src[2]);
                            ?>
" alt="<?php 
                            the_title();
                            ?>
" class="owl-lazy attachment-post-thumbnail wp-post-image" src="<?php 
                            echo esc_url($temping_post_thumbnail);
                            ?>
" data-src="<?php 
                            echo esc_url($thumbnail_src[0]);
                            ?>
" />
                                                    <?php 
                        } else {
                            ?>
                                                        <img width="<?php 
                            echo esc_attr($thumbnail_src[1]);
                            ?>
" height="<?php 
                            echo esc_attr($thumbnail_src[2]);
                            ?>
" alt="<?php 
                            the_title();
                            ?>
" class="owl-lazy attachment-post-thumbnail wp-post-image" src="<?php 
                            echo esc_url($temping_post_thumbnail);
                            ?>
" />
                                                    <?php 
                        }
                        ?>
                                                </a>
                                            </div>
                                        <?php 
                    }
                    ?>
                                        <div class="post-desc">
                                            <h5 class="post-title">
                                                <a  href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a>
                                            </h5>
                                            <div class="post-meta">
                                                <span class="date"><?php 
                    echo get_the_date('F j, Y');
                    ?>
</span>
                                            </div>
                                            <div class="desc">
                                                <?php 
                    the_excerpt();
                    ?>
                                            </div>
                                            <?php 
                    if (has_tag()) {
                        ?>
                                                <div class="meta-tags">
                                                   <i class="fa fa-tag"></i>
                                                   <?php 
                        the_tags();
                        ?>
                                                </div>
                                            <?php 
                    }
                    ?>
                                        </div>
                                    </li>
                                <?php 
                }
                ?>
                                <?php 
                remove_filter('excerpt_length', 'kt_custom_blog_excerpt_length');
                ?>
  
                            </ul>
                        </div>
                    </div>
                    <!-- ./blog list -->
                </div>
            </div>
            <?php 
            }
            if ($style == 'style-1') {
                ?>
            <!-- blog list -->
            <div class="blog-list <?php 
                echo esc_attr($elementClass);
                ?>
">
                <h2 class="page-heading">
                    <span class="page-heading-title"><?php 
                echo esc_html($title);
                ?>
</span>
                </h2>
                <div class="blog-list-wapper">
                    <ul class="owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                        <?php 
                while ($posts->have_posts()) {
                    $posts->the_post();
                    ?>
                        <li>
                            <?php 
                    if (has_post_thumbnail()) {
                        ?>
                            <div class="post-thumb image-hover2">
                                                      
                                <a href="<?php 
                        the_permalink();
                        ?>
">
                                    <?php 
                        $thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), "kt_post_blog_268x255");
                        if ($thumbnail_src) {
                            ?>
                                    <img width="<?php 
                            echo esc_attr($thumbnail_src[1]);
                            ?>
" height="<?php 
                            echo esc_attr($thumbnail_src[2]);
                            ?>
" alt="<?php 
                            the_title();
                            ?>
" class="owl-lazy attachment-post-thumbnail wp-post-image" src="<?php 
                            echo esc_url($temping_post_thumbnail);
                            ?>
" data-src="<?php 
                            echo esc_url($thumbnail_src[0]);
                            ?>
" />
                                    <?php 
                        } else {
                            ?>
                                        <img width="<?php 
                            echo esc_attr($thumbnail_src[1]);
                            ?>
" height="<?php 
                            echo esc_attr($thumbnail_src[2]);
                            ?>
" alt="<?php 
                            the_title();
                            ?>
" class="owl-lazy attachment-post-thumbnail wp-post-image" src="<?php 
                            echo esc_url($temping_post_thumbnail);
                            ?>
" />
                                    <?php 
                        }
                        ?>
                                 </a>
                            </div>
                            <?php 
                    }
                    ?>
    
                            <div class="post-desc">
                                <h5 class="post-title">
                                    <a  href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a>
                                </h5>
                                <div class="post-meta">
                                    <span class="date"><?php 
                    echo get_the_date('F j, Y');
                    ?>
</span>
                                    <span class="comment">
                                        <?php 
                    comments_number(__('0 Comment', 'kutetheme'), __('1 Comment', 'kutetheme'), __('% Comments', 'kutetheme'));
                    ?>
                                    </span>
                                </div>
                                <div class="readmore">
                                    <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    _e('Readmore', 'kutetheme');
                    ?>
</a>
                                </div>
                            </div>
                        </li>
                        <?php 
                }
                ?>
                    </ul>
                </div>
            </div>
            <!-- ./blog list -->
            <?php 
            }
            if ($style == 'style-3') {
                ?>
            <div class="block-blogs <?php 
                echo esc_attr($elementClass);
                ?>
">
                <?php 
                if ($title) {
                    ?>
                <h3 class="section-title"><?php 
                    echo esc_html($title);
                    ?>
</h3>
                <?php 
                }
                ?>
                <div class="blog-list">
                    <div class="blog-list-wapper">
                        <ul class="owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                            <?php 
                while ($posts->have_posts()) {
                    $posts->the_post();
                    ?>
                            <li>
                                <?php 
                    if (has_post_thumbnail()) {
                        ?>
                                <div class="post-thumb image-hover2">
                                    <a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_post_thumbnail('kt_post_blog_268x255');
                        ?>
</a>
                                </div>
                                <?php 
                    }
                    ?>
                                <div class="post-desc">
                                    <h5 class="post-title">
                                        <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a>
                                    </h5>
                                    <div class="post-meta">
                                        <span class="date"><?php 
                    echo get_the_date('F j, Y');
                    ?>
</span>
                                        <span class="comment">
                                        <?php 
                    comments_number(__('0 Comment', 'kutetheme'), __('1 Comment', 'kutetheme'), __('% Comments', 'kutetheme'));
                    ?>
                                        </span>
                                    </div>
                                    <div class="readmore">
                                        <a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    _e('Readmore', 'kutetheme');
                    ?>
</a>
                                    </div>
                                </div>
                            </li>
                            <?php 
                }
                ?>
                        </ul>
                    </div>
                </div>
            </div>
            <?php 
            }
            if ($style == 'style-4') {
                ?>
            <div class="section-blog-12 option12 <?php 
                echo esc_attr($elementClass);
                ?>
">
                <div class="section-title-12"><?php 
                echo esc_html($title);
                ?>
                    <?php 
                if (!empty($subtitle)) {
                    ?>
                        <span class="sub-title"><?php 
                    echo esc_html($subtitle);
                    ?>
</span>
                    <?php 
                }
                ?>
                </div>
                <?php 
                if ($posts->have_posts()) {
                    ?>
                    <div class="blogs-list owl-carousel" <?php 
                    echo _data_carousel($data_carousel);
                    ?>
>
                        <?php 
                    while ($posts->have_posts()) {
                        $posts->the_post();
                        ?>
                        <div class="blog12">
                            <?php 
                        if (has_post_thumbnail()) {
                            ?>
                                <div class="thumb banner-boder-zoom2">
                                    <a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_post_thumbnail('lookbook-thumb');
                            ?>
</a>
                                </div>
                            <?php 
                        }
                        ?>
                            <div class="info">
                                <span class="date"><?php 
                        echo get_the_date('j F');
                        ?>
</span>
                                <h2 class="blog-title"><a href="<?php 
                        the_permalink();
                        ?>
"><?php 
                        the_title();
                        ?>
</a></h2>
                                <a href="<?php 
                        the_permalink();
                        ?>
" class="read-more"><?php 
                        _e('Read more', 'kutetheme');
                        ?>
</a>
                            </div>
                        </div>
                        <?php 
                    }
                    ?>
                    </div>
                <?php 
                }
                ?>
            </div>
            <?php 
            }
            ?>
            <?php 
            if ($style == 'style-5') {
                ?>
            <div class="<?php 
                echo esc_attr($elementClass);
                ?>
">
                <?php 
                if ($title && $subtitle) {
                    ?>
                <div class="section-title-2">
                    <h2><?php 
                    echo esc_html($title);
                    ?>
</h2>
                    <span class="subtitle"><?php 
                    echo esc_html($subtitle);
                    ?>
</span>
                </div>
                <?php 
                }
                ?>
                <?php 
                if ($posts->have_posts()) {
                    ?>
                <div class="lasttest-blog11 owl-carousel" <?php 
                    echo _data_carousel($data_carousel);
                    ?>
>
                    <?php 
                    $i = 1;
                    while ($posts->have_posts()) {
                        $posts->the_post();
                        ?>
                    <?php 
                        if ($i % 2) {
                            ?>
                    <div class="item-blog">
                        <?php 
                            if (has_post_thumbnail()) {
                                ?>
                        <div class="thumb banner-boder-zoom2">
                            <a href="<?php 
                                the_permalink();
                                ?>
">
                            <?php 
                                the_post_thumbnail('lookbook-thumb');
                                ?>
                            </a>
                            <span class="cat"><?php 
                                echo get_the_date('F j, Y');
                                ?>
</span>
                        </div>
                        <?php 
                            }
                            ?>
                        <div class="info">
                            <h2 class="title"><a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a></h2>
                            <div class="desc"><?php 
                            the_excerpt();
                            ?>
</div>
                            <a class="readmore" href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            _e('Readmore', 'kutetheme');
                            ?>
</a>
                        </div>
                    </div>
                    <?php 
                        } else {
                            ?>
                    <div class="item-blog">
                        <div class="info">
                            <h2 class="title"><a href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            the_title();
                            ?>
</a></h2>
                            <div class="desc"><?php 
                            the_excerpt();
                            ?>
</div>
                            <a class="readmore" href="<?php 
                            the_permalink();
                            ?>
"><?php 
                            _e('Readmore', 'kutetheme');
                            ?>
</a>
                        </div>
                        <?php 
                            if (has_post_thumbnail()) {
                                ?>
                        <div class="thumb banner-boder-zoom2">
                            <a href="<?php 
                                the_permalink();
                                ?>
">
                            <?php 
                                the_post_thumbnail('lookbook-thumb');
                                ?>
                            </a>
                            <span class="cat"><?php 
                                echo get_the_date('F j, Y');
                                ?>
</span>
                        </div>
                        <?php 
                            }
                            ?>
                    </div>
                    <?php 
                        }
                        ?>
                    <?php 
                        $i++;
                    }
                    ?>
                </div>
                <?php 
                }
                ?>
            </div>
            <?php 
            }
            ?>
        <?php 
        }
        wp_reset_query();
        wp_reset_postdata();
        $result = ob_get_clean();
        return $result;
    }
Ejemplo n.º 25
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('product_carousel', $atts) : $atts;
        extract(shortcode_atts(array('title' => '', 'per_page' => 5, 'style' => '1', 'type' => 'hot-deals', 'taxonomy' => 0, 'orderby' => 'date', 'order' => 'DESC', 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 20, 'slidespeed' => 250, 'nav' => 'true', 'loop' => 'true', 'use_responsive' => 1, 'items_destop' => 5, 'items_tablet' => 3, 'items_mobile' => 1, 'css' => '', 'css_animation' => '', 'el_class' => ''), $atts));
        extract($atts);
        $style_class = 'style' . $style;
        $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $style_class, $this->settings['base'], $atts), 'extra' => $this->getExtraClass($el_class), '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, 'meta_query' => $meta_query);
        if ($type == 'hot-deals') {
            $product_ids_on_sale = wc_get_product_ids_on_sale();
            $args['post__in'] = array_merge(array(0), $product_ids_on_sale);
            if ($orderby == 'discount') {
                $newargs['meta_key'] = '_reduction_percent';
                $newargs['orderby'] = 'meta_value_num';
            } else {
                $args['orderby'] = $orderby;
            }
            $args['order'] = $order;
        } elseif ($type == 'best-selling') {
            $newargs['meta_key'] = 'total_sales';
            $newargs['orderby'] = 'meta_value_num';
        } elseif ($type == 'recent-product') {
            $args['orderby'] = $orderby;
            $args['order'] = $order;
        } elseif ($type == 'most-review') {
            add_filter('posts_clauses', array($this, 'order_by_rating_post_clauses'));
        }
        $cate_ids = array();
        if ($taxonomy) {
            $cate_ids = explode(",", $taxonomy);
            $args['tax_query'] = array(array('taxonomy' => 'product_cat', 'field' => 'id', 'terms' => $cate_ids));
        }
        $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
        ob_start();
        ?>
        <div class="edo-product-carousel <?php 
        echo esc_attr($elementClass);
        ?>
">
            <?php 
        if ($products->have_posts()) {
            ?>
            <?php 
            $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-top', "autoheight" => 'false', 'nav' => $navigation, 'dots' => 'false', 'loop' => $loop, 'autoplayTimeout' => 1000, 'autoplayHoverPause' => 'true');
            if ($products->post_count <= 1) {
                $data_carousel["loop"] = 'false';
            }
            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 {
                $data_carousel['items'] = $items_destop;
            }
            $unique_id = uniqid();
            $carousel = _data_carousel($data_carousel);
            ?>
            <div class="box-product-carousel">
                <?php 
            if ($title) {
                ?>
                <div class="box-title">
                    <h3 class="title"><?php 
                echo esc_html($title);
                ?>
</h3>
                </div>
                <?php 
            }
            ?>
                <ul class="products kt-owl-carousel" <?php 
            echo $carousel;
            ?>
>
                    <?php 
            while ($products->have_posts()) {
                $products->the_post();
                ?>
                        <li class="product style6 <?php 
                if ($style == 2) {
                    echo esc_attr('no-hiden');
                }
                ?>
">
                        <?php 
                wc_get_template_part('content', 'product-carousel' . $style);
                ?>
                        </li>
                        <?php 
            }
            ?>
                </ul>
            </div>
            <?php 
        } else {
            ?>
                <p><?php 
            _e('No Product.', 'edo');
            ?>
</p>
            <?php 
        }
        ?>
        </div>
        <?php 
        return ob_get_clean();
    }
Ejemplo n.º 26
0
    public function widget($args, $instance)
    {
        echo apply_filters('kt_wg_before_widget', $args['before_widget']);
        $title = isset($instance['title']) && $instance['title'] ? esc_html($instance['title']) : '';
        $number = isset($instance['number']) && intval($instance['number']) > 0 ? intval($instance['number']) : 3;
        $orderby = isset($instance['orderby']) && $instance['orderby'] ? esc_attr($instance['orderby']) : 'date';
        $order = isset($instance['order']) && $instance['order'] ? esc_attr($instance['order']) : 'desc';
        $autoplay = isset($instance['autoplay']) && $instance['autoplay'] ? "true" : "false";
        $loop = isset($instance['loop']) && $instance['loop'] ? "true" : "false";
        $slidespeed = isset($instance['slidespeed']) && intval($instance['slidespeed']) ? intval($instance['slidespeed']) : '250';
        if ($title) {
            echo apply_filters('kt_wg_before_title', $args['before_title']);
            echo esc_html($title);
            echo apply_filters('kt_wg_after_title', $args['after_title']);
        }
        $query = array('post_type' => 'testimonial', 'number' => intval($number), 'orderby' => esc_attr($orderby), 'order' => esc_attr($order));
        $data_carousel = array("autoplay" => $autoplay, "slidespeed" => $slidespeed, "theme" => 'style-navigation-bottom', 'nav' => "false", 'items' => 1);
        $pages = new WP_Query($query);
        if ($pages->have_posts()) {
            if ($pages->have_posts()) {
                $data_carousel['loop'] = esc_attr($loop);
            }
            ?>
           <!-- Testimonials -->
            <div class="block left-module container-testimonials">
                <div class="block_content">
                    <ul class="testimonials owl-carousel" <?php 
            echo _data_carousel($data_carousel);
            ?>
>
                        <?php 
            while ($pages->have_posts()) {
                $pages->the_post();
                ?>
                        <li>
                            <div class="client-mane"><?php 
                the_title();
                ?>
</div>
                            <div class="client-avarta">
                                <?php 
                the_post_thumbnail('110x110');
                ?>
                            </div>
                            <div class="testimonial">
                                <?php 
                the_content();
                ?>
                            </div>
                        </li>
                        <?php 
            }
            ?>
                    </ul>
                </div>
            </div>
            <!-- ./Testimonials -->
       <?php 
        }
        wp_reset_query();
        wp_reset_postdata();
        echo apply_filters('kt_wg_after_widget', $args['after_widget']);
    }
Ejemplo n.º 27
0
    protected function content($atts, $content = null)
    {
        $atts = function_exists('vc_map_get_attributes') ? vc_map_get_attributes('list_product', $atts) : $atts;
        $atts = shortcode_atts(array('title' => __('Today\'s offers', 'edo'), 'icon' => '', 'ids' => '', 'orderby' => 'custom', 'order' => 'desc', 'per_page' => 4, 'autoplay' => 'false', 'navigation' => 'false', 'margin' => 30, 'slidespeed' => 200, 'nav' => 'true', 'loop' => 'true', 'use_responsive' => 0, 'items_destop' => 2, 'items_tablet' => 2, 'items_mobile' => 2, 'css_animation' => '', 'el_class' => '', 'css' => ''), $atts);
        extract($atts);
        ob_start();
        $ids = explode(',', $ids);
        if (count($ids) > 0) {
            $elementClass = array('base' => apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'block block-offers ', $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, 'meta_query' => $meta_query, 'suppress_filter' => true, 'post__in' => $ids);
            if ($orderby == 'custom') {
                $args['orderby'] = 'post__in';
            } else {
                $args['orderby'] = $orderby;
                $args['order'] = $order;
            }
            $products = new WP_Query(apply_filters('woocommerce_shortcode_products_query', $args, $atts));
            if ($products->have_posts()) {
                $new_title = $title;
                $new_title = explode(',', $new_title);
                if (count($new_title) > 1) {
                    $title_sm = $new_title[0];
                    unset($new_title[0]);
                    $title_lg = implode(' ', $new_title);
                } else {
                    $title_sm = __('Today\'s', 'edo');
                    $title_lg = __('offers', 'edo');
                }
                $default_icon = KUTETHEME_PLUGIN_URL . 'js_composer/imgs/offers-icon.png';
                if (isset($icon) && $icon) {
                    $att_icon = wp_get_attachment_image_src($icon, array(37, 43));
                    $att_icon_url = is_array($att_icon) ? esc_url($att_icon[0]) : $default_icon;
                } else {
                    $att_icon_url = $default_icon;
                }
                $data_carousel = array("autoplay" => $autoplay, "navigation" => $navigation, "margin" => $margin, "slidespeed" => $slidespeed, "theme" => 'style-navigation-top', "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 {
                    $data_carousel['items'] = 2;
                }
                ?>
                <!-- block-offers -->
    			<div class="<?php 
                echo $elementClass;
                ?>
">
    				<div class="block-head">
    					<div class="block-title">
    						<div class="block-icon">
    							<img alt="<?php 
                echo $title;
                ?>
" title="<?php 
                echo $title;
                ?>
" src="<?php 
                echo $att_icon_url;
                ?>
" />
    						</div>
    						<div class="block-title-text text-sm"><?php 
                echo $title_sm;
                ?>
</div>
    						<div class="block-title-text text-lg"><?php 
                echo $title_lg;
                ?>
</div>
    					</div>
    				</div>
    				<div class="block-inner">
                        <?php 
                do_action("woocommerce_shortcode_before_list_product_loop");
                ?>
        					<ul class="products kt-owl-carousel" <?php 
                echo _data_carousel($data_carousel);
                ?>
>
                                <?php 
                while ($products->have_posts()) {
                    $products->the_post();
                    $id = get_the_ID();
                    $link = get_permalink($id);
                    ?>
                                    <?php 
                    edo_woocommerce_product_loop_item_before();
                    ?>
            							<?php 
                    wc_get_template_part('content', 'list-product');
                    ?>
                                    <?php 
                    edo_woocommerce_product_loop_item_after();
                    ?>
        						<?php 
                }
                ?>
        					</ul>
                        <?php 
                do_action("woocommerce_shortcode_after_list_product_loop");
                ?>
    				</div>
    			</div>
    			<!-- block-offers -->
            <?php 
            }
        }
        wp_reset_postdata();
        wp_reset_query();
        $result = ob_get_clean();
        return $result;
    }