如何解决如何在WooCommerce子主题中更改FlexSlider选项
我刚刚更改了Woocommerce的“ includes”文件夹中可用的class-wc-frontend-scripts.php文件的这一部分:
'flexslider' => apply_filters( 'woocommerce_single_product_carousel_options',array(
'rtl' => is_rtl(),'animation' => 'fade','easing' => 'swing','smoothHeight' => true,'directionNav' => false,'controlNav' => true,'slideshow' => true,'touch' => true,'animationSpeed' => 1200,'slideshowSpeed' => 3500,'animationLoop' => true,// Breaks photoswipe pagination if true.
'allowOneSlide' => true,'prevText' => "<",//String: Set the text for the "previous" directionNav item
'nextText' => ">",//String: Set the text for the "next" directionNav item
)
),
如何将其转换为儿童主题?
解决方法
不要覆盖任何核心文件…而是可以使用woocommerce_single_product_carousel_options过滤器挂钩,如下所示:
add_filter( 'woocommerce_single_product_carousel_options','filter_single_product_carousel_options' );
function filter_single_product_carousel_options( $args ) {
$args['animation'] = 'fade';
$args['easing'] = 'swing';
$args['controlNav'] = true;
$args['slideshow'] = true;
$args['touch'] = true;
$args['animationSpeed'] = 1200;
$args['slideshowSpeed'] = 3500;
$args['animationLoop'] = true; // Breaks photoswipe pagination if true.
$args['allowOneSlide'] = true;
$args['prevText'] = "<"; // String - Set the text for the "previous" directionNav item
$args['nextText'] = ">"; // String - Set the text for the "next" directionNav item
return $args;
}
代码进入活动子主题(或活动主题)的functions.php文件中。应该可以。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。