Erstellen Sie ein Produktarchiv mit Registerkarten für Ihren WooCommerce Store
() translation by (you can also view the original English article)
In diesem Tutorial erfahren Sie, wie Sie Ihren WooCommerce-Shop ein wenig stilvoller gestalten, indem Sie das Produktarchiv mit Registerkarten organisieren. Wir erstellen Registerkarten mit einem mehrspaltigen Layout, einem mehrzeiligen Karussell und einem Rasterlayout.
Was werden wir schaffen
In den nächsten Schritten werden wir ein WordPress-Plugin erstellen, in dem wir die erforderlichen Shortcodes einrichten. Wenn Sie Ihr WooCommerce-Produktarchiv weiterentwickeln möchten, können Sie es in einen Gutenberg-Block konvertieren, mit Elementor als Widget verwenden oder in Visual Composer integrieren.
Dieses Produktarchiv mit Registerkarten eignet sich perfekt für die Anzeige der neuesten, vorgestellten, verkauften und meistverkauften Produkte wie folgt:



Also lasst uns anfangen!
1. Erstellung von einem WordPress-Plugin
Erstellen Sie auf Ihrer WordPress-Site unter wp-content/plugins einen Ordner mit dem Namen "woocommerce-products" (möglicherweise nicht der ursprünglichste Name) und erstellen Sie dann in diesem Ordner eine PHP-Datei mit demselben Namen. Öffnen Sie die Datei und fügen Sie den folgenden Code ein (ändern Sie die Details entsprechend Ihren eigenen):
1 |
/*
|
2 |
Plugin Name: WooCommerce products
|
3 |
Plugin URI: https://www.enovathemes.com
|
4 |
Description: Better product grouping presentation for your WooCommerce shop
|
5 |
Author: Enovathemes
|
6 |
Version: 1.0
|
7 |
Author URI: https://enovathemes.com
|
8 |
*/
|
9 |
|
10 |
if ( ! defined( 'ABSPATH' ) ) { |
11 |
exit; // Exit if accessed directly |
12 |
}
|
Hier haben wir lediglich unseren Plugin-Namen definiert und einige Meta-Informationen bereitgestellt.
Enqueue-Skripte und -Stile
Für unser WooCommerce-Produktarchiv-Plugin müssen wir als Nächstes die erforderlichen Skripte und Stile in die Queue stellen. Fügen Sie den folgenden Codeausschnitt hinzu:
1 |
// Enqueue/register styles and scripts
|
2 |
function plugin_scripts_styles(){ |
3 |
|
4 |
wp_enqueue_style( 'style', plugins_url('/css/style.css', __FILE__ ), array(), '1.0.0' ); |
5 |
|
6 |
// Required Plugins
|
7 |
wp_enqueue_script( 'imagesloaded'); |
8 |
wp_enqueue_script( 'owl-carousel', plugins_url('/js/owl.carousel.js', __FILE__ ), array('jquery'), '', true); |
9 |
// Main js file
|
10 |
wp_enqueue_script( 'main', plugins_url('/js/main.js', __FILE__ ), array('jquery'), '', true); |
11 |
}
|
12 |
add_action( 'wp_enqueue_scripts', 'plugin_scripts_styles' ); |
Zunächst haben wir eine grundlegende CSS-Datei hinzugefügt, um unsere Stile zu speichern. Als nächstes haben wir das eingebaute imageLoaded-Plugin (das mit dem WordPress-Kern geliefert wird) geladen. Um das Karussell zu erstellen, verwenden wir das äußerst beliebte jQuery-Plugin owlCarousel. Und natürlich die main js file.
Hinweis: Kontrollieren Sie, dass diese Dateien Ihrem Plugin-Ordner in den entsprechenden Unterordnern hinzugefügt werden.
Weitere Informationen zur Erstellung von WordPress-Plugins und Shortcodes oder weitere Informationen zur Verwendung von owl.js finden Sie in den empfohlenen Tutorials zu Tuts+:
- jQueryWie erstellt man mit Owl.js einen responsiv Web Karussell im Full-ScreenGeorge Martsoukos
- PluginsKurztipp: Verwendung von Shortcodes in der ThemenentwicklungSumeet Chawla
- WordPress Plugins3 Praktische Projekte zum Codieren von WordPress-PluginsRachel McCollin
- WordPressEinführung in die Entwicklung von WordPress-PluginsRachel McCollin
2. Erstellen Sie einen Tab-Shortcode
In diesem Schritt erstellen wir einen Tab-Shortcode. Es wird tatsächlich aus zwei Shortcodes bestehen; den übergeordneten Registerkartencontainer und dann die untergeordneten Registerkartenelemente. Fügen Sie für den ersten übergeordneten Container diesen Code zur PHP-Datei hinzu:
1 |
// Create tab shortcode
|
2 |
function et_tab($atts, $content = null) { |
3 |
|
4 |
extract(shortcode_atts(array(), $atts)); |
5 |
|
6 |
$output = ''; |
7 |
|
8 |
static $id_counter = 1; |
9 |
|
10 |
$class = array(); |
11 |
$class[] = 'et-tab'; |
12 |
$class[] = 'et-clearfix'; |
13 |
|
14 |
$output .='<div id="et-tab-'.$id_counter.'" class="'.implode(" ", $class).'">'; |
15 |
$output .= do_shortcode($content); |
16 |
$output .= '</div>'; |
17 |
|
18 |
$id_counter++; |
19 |
|
20 |
return $output; |
21 |
|
22 |
}
|
23 |
add_shortcode('et_tab', 'et_tab'); |
Dieser Shortcode fordert keine Attribute, aber es wird nur die Tab-Elemente darin eingeschlossen.
Wenn Sie von Tab-Elementen sprechen, fügen Sie als Nächstes den folgenden Code hinzu, um Child Tab-Element zu erstellen:
1 |
function et_tab_item($atts, $content = null) { |
2 |
|
3 |
extract(shortcode_atts(array( |
4 |
'title' => '', |
5 |
'active' => 'false', |
6 |
), $atts)); |
7 |
|
8 |
$output = ''; |
9 |
|
10 |
static $id_counter = 1; |
11 |
|
12 |
$class = array(); |
13 |
$class[] = 'tab-item'; |
14 |
$class[] = 'et-clearfix'; |
15 |
$class[] = 'active-'.esc_attr($active); |
16 |
|
17 |
$output .= '<div data-target="tab-'. sanitize_title( $title ) .'" class="'.implode(' ',$class).'">'; |
18 |
if (isset($title) && !empty($title)) { |
19 |
$output .= esc_attr($title); |
20 |
}
|
21 |
$output .= '</div> '; |
22 |
$output .= '<div id="tab-'.sanitize_title($title).'-'.$id_counter.'" class="tab-content et-clearfix">'; |
23 |
$output .= do_shortcode($content); |
24 |
$output .= '</div>'; |
25 |
|
26 |
$id_counter++; |
27 |
|
28 |
return $output; |
29 |
}
|
30 |
add_shortcode('et_tab_item', 'et_tab_item'); |
Dieser Shortcode hat zwei Attribute; den Titel und den aktiven Anzeiger, falls Sie die Zielregisterkarte beim ersten Laden aktivieren möchten.
Bei Verwendung im WordPress-Editor sehen die beiden Shortcodes zusammen folgendermaßen aus:
1 |
[et_tab] [et_tab_item title="Your title"] …content here[/et_tab_item][/et_tab] |
Wenn Sie sie zu diesem Zeitpunkt zu Ihrer Startseite hinzufügen und dann das Ergebnis in Ihrem Browser anzeigen, wird eine nicht gestaltete und nicht funktionierende HTML-Ausgabe angezeigt. Also lasst es uns beheben.
3. Fügen Sie jQuery hinzu, um den Inhalt mit Registerkarten zu aktivieren
Gehen Sie zur Datei main.js und fügen Sie den Code ein
1 |
(function($){ |
2 |
|
3 |
"use strict"; |
4 |
|
5 |
$('.et-tab').each(function(){ |
6 |
|
7 |
var $this = $(this), |
8 |
tabs = $this.find('.tab-item'), |
9 |
tabsQ = tabs.length, |
10 |
tabsContent = $this.find('.tab-content'); |
11 |
|
12 |
tabs.wrapAll('<div class="tabset et-clearfix"></div>'); |
13 |
tabsContent.wrapAll('<div class="tabs-container et-clearfix"></div>'); |
14 |
|
15 |
var tabSet = $this.find('.tabset'); |
16 |
|
17 |
if(!tabs.hasClass('active')){ |
18 |
tabs.first().addClass('active'); |
19 |
}
|
20 |
|
21 |
tabs.each(function(){ |
22 |
|
23 |
var $thiz = $(this); |
24 |
|
25 |
if ($thiz.hasClass('active')) { |
26 |
$thiz.siblings() |
27 |
.removeClass("active"); |
28 |
tabsContent.hide(0).removeClass('active'); |
29 |
tabsContent.eq($thiz.index()).show(0).addClass('active'); |
30 |
}
|
31 |
});
|
32 |
|
33 |
if(tabsQ >= 2){ |
34 |
|
35 |
tabs.on('click', function(){ |
36 |
var $self = $(this); |
37 |
|
38 |
if(!$self.hasClass("active")){ |
39 |
|
40 |
$self.addClass("active"); |
41 |
|
42 |
$self.siblings() |
43 |
.removeClass("active"); |
44 |
|
45 |
tabsContent.hide(0).removeClass('active'); |
46 |
tabsContent.eq($self.index()).show(0).addClass('active'); |
47 |
|
48 |
}
|
49 |
|
50 |
});
|
51 |
}
|
52 |
|
53 |
});
|
54 |
|
55 |
})(jQuery); |
Ich werde diesen ganzen Code nicht im Detail beschreiben, aber die Logik hier unterstützt die Tab-Funktionalität. Wenn Sie nicht mit JavaScript oder jQuery vertraut sind, empfehle ich diesen erstaunlichen kostenlosen Kurs für Anfänger:
Gestalten Sie die Tabs
Jetzt funktionieren die Registerkarten, aber sie sehen immer noch hässlich aus. Fügen wir also einige grundlegende CSS hinzu:
1 |
.tabset { |
2 |
margin-bottom: 24px; |
3 |
}
|
4 |
|
5 |
.tabset > * { |
6 |
display: inline-block; |
7 |
vertical-align: middle; |
8 |
padding: 8px 16px; |
9 |
line-height: 1em; |
10 |
background: #f5f5f5; |
11 |
margin-right: 8px; |
12 |
cursor: pointer; |
13 |
}
|
14 |
|
15 |
.tabset > .active { |
16 |
background: #000000; |
17 |
color: #ffffff; |
18 |
}
|
19 |
|
20 |
.tabset > :last-child { |
21 |
margin-right: 0; |
22 |
}
|
4. Erstellen Sie den Shortcode für WooCommerce-Produkte
Wir machen große Fortschritte. Unser WooCommerce-Produktarchiv mit Registerkarten ist fast da! Es ist an der Zeit, einen Shortcode für die Produkte zu erstellen. Dadurch werden die Produkte mit einer Abfrage abgerufen und aus diesen Ergebnissen eine Reihe von Arrays erstellt: vorgestellte, verkaufte und meistverkaufte Produkte. Anschließend wird der Inhalt dieser Arrays ausgegeben, um uns unsere Produktregisterkarten zu geben.
Fügen Sie diesen Code der PHP-Datei hinzu:
1 |
function et_products($atts, $content = null) { |
2 |
extract(shortcode_atts( |
3 |
array( |
4 |
'layout' => 'grid', // grid OR carousel |
5 |
'autoplay' => 'false', // true OR false |
6 |
'columns' => '1', // 1 | 2 | 3 | 4 |
7 |
'rows' => '1', // 1 | 2 | 3 | 4 - carousel only |
8 |
'quantity' => '12', |
9 |
'type' => 'recent', // recent | featured | sale | best_selling |
10 |
), $atts) |
11 |
);
|
12 |
|
13 |
static $id_counter = 1; |
14 |
|
15 |
if (class_exists('Woocommerce')) { |
16 |
|
17 |
$output = ''; |
18 |
|
19 |
global $post; |
20 |
|
21 |
$query_options = array( |
22 |
'post_type' => 'product', |
23 |
'post_status' => 'publish', |
24 |
'meta_query' => WC()->query->get_meta_query(), |
25 |
'tax_query' => WC()->query->get_tax_query(), |
26 |
'ignore_sticky_posts' => 1, |
27 |
'posts_per_page' => absint($quantity), |
28 |
);
|
29 |
|
30 |
if ($type == "featured"){ |
31 |
$query_options = array( |
32 |
'post_type' => 'product', |
33 |
'post_status' => 'publish', |
34 |
'meta_query' => WC()->query->get_meta_query(), |
35 |
'ignore_sticky_posts' => 1, |
36 |
'posts_per_page' => absint($quantity), |
37 |
'tax_query' => array( |
38 |
array( |
39 |
'taxonomy' => 'product_visibility', |
40 |
'field' => 'name', |
41 |
'terms' => 'featured', |
42 |
'operator' => 'IN', |
43 |
)
|
44 |
),
|
45 |
);
|
46 |
}
|
47 |
|
48 |
if ($type == "sale"){ |
49 |
$query_options = array( |
50 |
'post_type' => 'product', |
51 |
'post_status' => 'publish', |
52 |
'meta_query' => WC()->query->get_meta_query(), |
53 |
'ignore_sticky_posts' => 1, |
54 |
'posts_per_page' => absint($quantity), |
55 |
'post__in' => array_merge( array( 0 ), wc_get_product_ids_on_sale() ), |
56 |
);
|
57 |
}
|
58 |
|
59 |
if ($type == "best_selling"){ |
60 |
|
61 |
$query_options = array( |
62 |
'post_type' => 'product', |
63 |
'post_status' => 'publish', |
64 |
'meta_query' => WC()->query->get_meta_query(), |
65 |
'tax_query' => WC()->query->get_tax_query(), |
66 |
'ignore_sticky_posts' => 1, |
67 |
'posts_per_page' => absint($quantity), |
68 |
'orderby' => 'meta_value_num', |
69 |
'meta_key' => 'total_sales', |
70 |
);
|
71 |
}
|
72 |
|
73 |
$products = new WP_Query($query_options); |
74 |
|
75 |
if($products->have_posts()){ |
76 |
|
77 |
$counter = 1; |
78 |
|
79 |
$class = array(); |
80 |
$attributes = array(); |
81 |
|
82 |
$class[] = 'products'; |
83 |
$class[] = esc_attr($layout); |
84 |
|
85 |
if ($layout == 'carousel') { |
86 |
$class[] = 'owl-carousel'; |
87 |
}
|
88 |
|
89 |
$attributes[] = 'data-columns="'.esc_attr($columns).'"'; |
90 |
$attributes[] = 'data-autoplay="'.esc_attr($autoplay).'"'; |
91 |
|
92 |
$output .= '<ul class="'.esc_attr(implode(' ', $class)).'" '.implode(' ', $attributes).'>'; |
93 |
|
94 |
while ($products->have_posts() ) { |
95 |
|
96 |
$products->the_post(); |
97 |
|
98 |
global $product; |
99 |
|
100 |
if ($layout == "carousel" && $rows != 1) { |
101 |
|
102 |
$product_wrapper_start = ''; |
103 |
$product_wrapper_end = ''; |
104 |
|
105 |
if (($counter % 2 == 1 && $rows == 2) || ($counter % 3 == 1 && $rows == 3) || ($counter % 4 == 1 && $rows == 4)){ |
106 |
$product_wrapper_start = '<li class="product-wrapper">'; |
107 |
}
|
108 |
|
109 |
if (($counter % 2 == 0 && $rows == 2) || ($counter % 3 == 0 && $rows == 3) || ($counter % 4 == 0 && $rows == 4)){ |
110 |
$product_wrapper_end = '</li>'; |
111 |
}
|
112 |
|
113 |
$output .= $product_wrapper_start; |
114 |
$output .= '<div class="product" id="product-'.esc_attr($product->get_id()).'">'; |
115 |
ob_start(); |
116 |
do_action( 'woocommerce_before_shop_loop_item' ); |
117 |
do_action( 'woocommerce_before_shop_loop_item_title' ); |
118 |
do_action( 'woocommerce_shop_loop_item_title' ); |
119 |
do_action( 'woocommerce_after_shop_loop_item_title' ); |
120 |
do_action( 'woocommerce_after_shop_loop_item' ); |
121 |
$output .= ob_get_clean(); |
122 |
$output .= '</div>'; |
123 |
$output .= $product_wrapper_end; |
124 |
|
125 |
$counter++; |
126 |
|
127 |
} else { |
128 |
$output .= '<li class="product" id="product-'.esc_attr($product->get_id()).'">'; |
129 |
ob_start(); |
130 |
do_action( 'woocommerce_before_shop_loop_item' ); |
131 |
do_action( 'woocommerce_before_shop_loop_item_title' ); |
132 |
do_action( 'woocommerce_shop_loop_item_title' ); |
133 |
do_action( 'woocommerce_after_shop_loop_item_title' ); |
134 |
do_action( 'woocommerce_after_shop_loop_item' ); |
135 |
$output .= ob_get_clean(); |
136 |
$output .= '</li>'; |
137 |
}
|
138 |
|
139 |
}
|
140 |
|
141 |
wp_reset_postdata(); |
142 |
|
143 |
$output .= '</ul>'; |
144 |
|
145 |
$id_counter++; |
146 |
|
147 |
return $output; |
148 |
|
149 |
}
|
150 |
|
151 |
} else { |
152 |
echo "Please install/activate Woocommerce plugin"; |
153 |
}
|
154 |
}
|
155 |
add_shortcode('et_products', 'et_products'); |
Der hier erstellte Shortcode weist mehrere Attribute auf:
- Layout - Es kann ein Raster oder ein Karussell sein
- Autoplay - richtig oder falsch, das ist eine zusätzliche Option für das Karussell-Layout
- Columns - Hier können Sie angeben, wie viele Spalten Sie haben möchten
- Rows - Sie entsprichen den Spalten und gelten nur für das Karusselllayout
- Menge/Quantity - Die Anzahl der anzuzeigenden Elemente
- Typ/Type - hier können Sie aktuelle Produkte, Bestseller, Verkauf oder vorgestellte Produkte angeben
Ein Hinweis zu unseren Karussellzeilen
Wenn Sie ein Karussell haben, wird jedes Produkt zu einem Karussellartikel - normales Verhalten, wenn Sie eine Reihe haben. Was passiert jedoch, wenn Sie zwei, drei oder vier Reihen pro Karussellartikel möchten?
In diesem Fall müssten Sie jede dieser Möglichkeiten in eine Hülle einwickeln, die als Karussellelement fungiert. Und Sie haben die Frage: Tun Sie dies mit JavaScript oder mit PHP? Ich bevorzuge die zweite Option, da JS einige Verzögerungen bei der Ausführung hat. Wenn Sie also den Shortcode untersuchen, finden Sie Folgendes:
1 |
$product_wrapper_start = ''; |
2 |
$product_wrapper_end = ''; |
3 |
|
4 |
if (($counter % 2 == 1 && $rows == 2) || ($counter % 3 == 1 && $rows == 3) || ($counter % 4 == 1 && $rows == 4)){ |
5 |
$product_wrapper_start = '<li class="product-wrapper">'; |
6 |
}
|
7 |
|
8 |
if (($counter % 2 == 0 && $rows == 2) || ($counter % 3 == 0 && $rows == 3) || ($counter % 4 == 0 && $rows == 4)){ |
9 |
$product_wrapper_end = '</li>'; |
10 |
}
|
Beachten Sie das
1 |
$counter = 1; |
gleich danach
1 |
if($products->have_posts()){ |
Das ist ähnluch wie for
Schleife. Wir benötigen ein Inkrement, um unsere Abfrage zu durchlaufen und jeweils zwei, jeweils drei und jeweils vier Produktelemente in das Karussellelement-Wrapper-Markup einzubinden.
Sie werden das %
bemerken, das der Modulo-Operator ist. Es gibt den Rest einer Teilung; 0, wenn die Zahl genau durch 2/3/4 teilbar ist, und 1, wenn nicht. Und mit jeder Schleife müssen wir den Zähler erhöhen mit:
1 |
$counter++; |
Das geschieht direkt nach dem Code:
1 |
$output .= $product_wrapper_start; |
2 |
$output .= '<div class="product" id="product-'.esc_attr($product->get_id()).'">'; |
3 |
ob_start(); |
4 |
do_action( 'woocommerce_before_shop_loop_item' ); |
5 |
do_action( 'woocommerce_before_shop_loop_item_title' ); |
6 |
do_action( 'woocommerce_shop_loop_item_title' ); |
7 |
do_action( 'woocommerce_after_shop_loop_item_title' ); |
8 |
do_action( 'woocommerce_after_shop_loop_item' ); |
9 |
$output .= ob_get_clean(); |
10 |
$output .= '</div>'; |
11 |
$output .= $product_wrapper_end; |
5. Hinzufügung Owl Styles 🦉�
1 |
ul.products { |
2 |
list-style: none; |
3 |
margin: 0; |
4 |
padding: 0; |
5 |
}
|
6 |
|
7 |
ul.products.grid { |
8 |
display: grid; |
9 |
grid-row-gap: 24px; |
10 |
grid-column-gap: 24px; |
11 |
}
|
12 |
|
13 |
ul.products.grid[data-columns="2"]{grid-template-columns: repeat(2, 2fr);} |
14 |
ul.products.grid[data-columns="3"]{grid-template-columns: repeat(3, 3fr);} |
15 |
ul.products.grid[data-columns="4"]{grid-template-columns: repeat(4, 4fr);} |
16 |
|
17 |
ul li { |
18 |
display: block; |
19 |
padding: 0; |
20 |
margin: 0 |
21 |
}
|
22 |
|
23 |
.product { |
24 |
position: relative; |
25 |
text-align: center; |
26 |
}
|
27 |
|
28 |
.woocommerce-loop-product__title { |
29 |
margin-top: 16px !important; |
30 |
font-size: 1em !important; |
31 |
}
|
32 |
|
33 |
.product a { |
34 |
display: block; |
35 |
text-decoration: none; |
36 |
border-bottom: none !important; |
37 |
}
|
38 |
|
39 |
.product .onsale { |
40 |
position: absolute; |
41 |
left: 0; |
42 |
padding: 4px; |
43 |
background: red; |
44 |
color: #ffffff; |
45 |
}
|
46 |
.et-tab .owl-nav { |
47 |
position: absolute; |
48 |
top: -60px; |
49 |
right: 0; |
50 |
}
|
51 |
|
52 |
.et-tab .owl-nav > * { |
53 |
display: inline-block; |
54 |
vertical-align: middle; |
55 |
width: 40px; |
56 |
height: 40px; |
57 |
text-align: center; |
58 |
line-height: 40px; |
59 |
background: #f5f5f5 !important; |
60 |
}
|
61 |
|
62 |
.et-tab .owl-nav > :last-child { |
63 |
margin-left: 8px; |
64 |
}
|
65 |
|
66 |
.et-tab .owl-nav > *:hover { |
67 |
background: #000000 !important; |
68 |
color: #ffffff !important; |
69 |
}
|
1 |
// Initialize carousel for the first load
|
2 |
|
3 |
$('.products.carousel').each(function(){ |
4 |
|
5 |
var $this = $(this); |
6 |
$this.imagesLoaded(function(){ |
7 |
$this.owlCarousel({ |
8 |
margin:24, |
9 |
nav:true, |
10 |
autoplay:$this.data('autoplay'), |
11 |
items:$this.data('columns'), |
12 |
responsive:{ |
13 |
320 : {items:1}, |
14 |
768 : {items:2}, |
15 |
1024 : {items:3}, |
16 |
1280 : {items:$this.data('columns')} |
17 |
},
|
18 |
});
|
19 |
});
|
20 |
|
21 |
});
|
6. Bessern Sie den Karussellglitchh aktiven Registerkarte angezeigt. Wenn Sie jedoch von Registerkarte zu Registerkarte wechseln, wird Ihr Karusselllayout angezeigt wird brechen. Auf der Registerkarte Änderungsereignis muss unser Karussell aktualisiert werden. Fügen Sie also ganz am Anfang der Datei die Funktion hinzu::
1
function refreshCarousel(tab){
2
tab.find('.products.carousel').each(function(){
3
jQuery(this).trigger('refresh.owl.carousel');
4
});
5
}
1
tabsContent.eq($self.index()).show(0).addClass('active');
1
refreshCarousel(tabsContent.eq($self.index()));
1
<!-- wp:shortcode -->
2
[et_tab][et_tab_item title="recent"][et_products layout="grid" autoplay="false" columns="3" rows="1" quantity="6" type="recent" /][/et_tab_item][et_tab_item title="featured"][et_products layout="grid" autoplay="false" columns="3" rows="1" quantity="6" type="featured" /][/et_tab_item][et_tab_item title="sale"][et_products layout="grid" autoplay="false" columns="3" rows="1" quantity="6" type="sale" /][/et_tab_item][et_tab_item title="best selling"][et_products layout="grid" autoplay="false" columns="3" rows="1" quantity="6" type="best_selling" /][/et_tab_item][/et_tab]
3
<!-- /wp:shortcode -->
4
5
<!-- wp:separator -->
6
<hr class="wp-block-separator"/>
7
<!-- /wp:separator -->
8
9
<!-- wp:shortcode -->
10
[et_tab][et_tab_item title="recent"][et_products layout="grid" autoplay="false" columns="4" rows="1" quantity="8" type="recent" /][/et_tab_item][et_tab_item title="featured"][et_products layout="grid" autoplay="false" columns="4" rows="1" quantity="8" type="featured" /][/et_tab_item][et_tab_item title="sale"][et_products layout="grid" autoplay="false" columns="4" rows="1" quantity="8" type="sale" /][/et_tab_item][et_tab_item title="best selling"][et_products layout="grid" autoplay="false" columns="4" rows="1" quantity="8" type="best_selling" /][/et_tab_item][/et_tab]
11
<!-- /wp:shortcode -->
12
13
<!-- wp:separator -->
14
<hr class="wp-block-separator"/>
15
<!-- /wp:separator -->
16
17
<!-- wp:shortcode -->
18
[et_tab][et_tab_item title="recent"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="recent" /][/et_tab_item][et_tab_item title="featured"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="featured" /][/et_tab_item][et_tab_item title="sale"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="sale" /][/et_tab_item][et_tab_item title="best selling"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="best_selling" /][/et_tab_item][/et_tab]
19
<!-- /wp:shortcode -->
20
21
<!-- wp:separator -->
22
<hr class="wp-block-separator"/>
23
<!-- /wp:separator -->
24
25
<!-- wp:shortcode -->
26
[et_tab][et_tab_item title="recent"][et_products layout="carousel" autoplay="false" columns="4" rows="2" quantity="12" type="recent" /][/et_tab_item][et_tab_item title="featured"][et_products layout="carousel" autoplay="false" columns="2" rows="2" quantity="12" type="featured" /][/et_tab_item][et_tab_item title="sale"][et_products layout="carousel" autoplay="false" columns="3" rows="2" quantity="12" type="sale" /][/et_tab_item][et_tab_item title="best selling"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="best_selling" /][/et_tab_item][/et_tab]
27
<!-- /wp:shortcode -->
<!--wp:separator -->). Wenn Sie den klassischen Editor haben, kopieren Sie einfach die Shortcodes.. ein schönes Layout, wie dieses, sehen!> Repo auf Github, um den Quellcode vollständig abzurufen. Ich hoffe, Sie finden es nützlich, danke fürs Lesen!!
1 |
function refreshCarousel(tab){ |
2 |
tab.find('.products.carousel').each(function(){ |
3 |
jQuery(this).trigger('refresh.owl.carousel'); |
4 |
});
|
5 |
}
|
1 |
tabsContent.eq($self.index()).show(0).addClass('active'); |
1 |
refreshCarousel(tabsContent.eq($self.index())); |
1 |
<!-- wp:shortcode -->
|
2 |
[et_tab][et_tab_item title="recent"][et_products layout="grid" autoplay="false" columns="3" rows="1" quantity="6" type="recent" /][/et_tab_item][et_tab_item title="featured"][et_products layout="grid" autoplay="false" columns="3" rows="1" quantity="6" type="featured" /][/et_tab_item][et_tab_item title="sale"][et_products layout="grid" autoplay="false" columns="3" rows="1" quantity="6" type="sale" /][/et_tab_item][et_tab_item title="best selling"][et_products layout="grid" autoplay="false" columns="3" rows="1" quantity="6" type="best_selling" /][/et_tab_item][/et_tab] |
3 |
<!-- /wp:shortcode -->
|
4 |
|
5 |
<!-- wp:separator -->
|
6 |
<hr class="wp-block-separator"/> |
7 |
<!-- /wp:separator -->
|
8 |
|
9 |
<!-- wp:shortcode -->
|
10 |
[et_tab][et_tab_item title="recent"][et_products layout="grid" autoplay="false" columns="4" rows="1" quantity="8" type="recent" /][/et_tab_item][et_tab_item title="featured"][et_products layout="grid" autoplay="false" columns="4" rows="1" quantity="8" type="featured" /][/et_tab_item][et_tab_item title="sale"][et_products layout="grid" autoplay="false" columns="4" rows="1" quantity="8" type="sale" /][/et_tab_item][et_tab_item title="best selling"][et_products layout="grid" autoplay="false" columns="4" rows="1" quantity="8" type="best_selling" /][/et_tab_item][/et_tab] |
11 |
<!-- /wp:shortcode -->
|
12 |
|
13 |
<!-- wp:separator -->
|
14 |
<hr class="wp-block-separator"/> |
15 |
<!-- /wp:separator -->
|
16 |
|
17 |
<!-- wp:shortcode -->
|
18 |
[et_tab][et_tab_item title="recent"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="recent" /][/et_tab_item][et_tab_item title="featured"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="featured" /][/et_tab_item][et_tab_item title="sale"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="sale" /][/et_tab_item][et_tab_item title="best selling"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="best_selling" /][/et_tab_item][/et_tab] |
19 |
<!-- /wp:shortcode -->
|
20 |
|
21 |
<!-- wp:separator -->
|
22 |
<hr class="wp-block-separator"/> |
23 |
<!-- /wp:separator -->
|
24 |
|
25 |
<!-- wp:shortcode -->
|
26 |
[et_tab][et_tab_item title="recent"][et_products layout="carousel" autoplay="false" columns="4" rows="2" quantity="12" type="recent" /][/et_tab_item][et_tab_item title="featured"][et_products layout="carousel" autoplay="false" columns="2" rows="2" quantity="12" type="featured" /][/et_tab_item][et_tab_item title="sale"][et_products layout="carousel" autoplay="false" columns="3" rows="2" quantity="12" type="sale" /][/et_tab_item][et_tab_item title="best selling"][et_products layout="carousel" autoplay="false" columns="3" rows="1" quantity="12" type="best_selling" /][/et_tab_item][/et_tab] |
27 |
<!-- /wp:shortcode -->
|