admin管理员组文章数量:1130349
I would like to add a class to the existing woocommerce product widget.
The file '/includes/widgets/class-wc-widget-products.php' has the following filter.
echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
Is there a method that I can edit the html <ul class="product_list_widget"> in that filter within my theme?
I would like to add a class to the existing woocommerce product widget.
The file '/includes/widgets/class-wc-widget-products.php' has the following filter.
echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
Is there a method that I can edit the html <ul class="product_list_widget"> in that filter within my theme?
1 Answer
Reset to default 1You can use the given filter to change the html.
Use this in your themes functions.php file
function wpse240457_add_class($html) {
$html = '<ul class="product_list_widget your-new-class">';
return $html;
}
add_filter('woocommerce_before_widget_product_list', 'wpse240457_add_class', 1, 15);
I would like to add a class to the existing woocommerce product widget.
The file '/includes/widgets/class-wc-widget-products.php' has the following filter.
echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
Is there a method that I can edit the html <ul class="product_list_widget"> in that filter within my theme?
I would like to add a class to the existing woocommerce product widget.
The file '/includes/widgets/class-wc-widget-products.php' has the following filter.
echo apply_filters( 'woocommerce_before_widget_product_list', '<ul class="product_list_widget">' );
Is there a method that I can edit the html <ul class="product_list_widget"> in that filter within my theme?
1 Answer
Reset to default 1You can use the given filter to change the html.
Use this in your themes functions.php file
function wpse240457_add_class($html) {
$html = '<ul class="product_list_widget your-new-class">';
return $html;
}
add_filter('woocommerce_before_widget_product_list', 'wpse240457_add_class', 1, 15);
本文标签: How can I edit the Woocommerce product widget html class
版权声明:本文标题:How can I edit the Woocommerce product widget html class? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749213796a2333819.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论