亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何更改 WooCommerce 子主題中的 FlexSlider 選項

如何更改 WooCommerce 子主題中的 FlexSlider 選項

PHP
繁花如伊 2023-10-21 09:55:41
我剛剛更改了 class-wc-frontend-scripts.php 文件的這一部分,該文件可在 Woocommerce 的“includes”文件夾中找到:'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    )),如何將其轉移到兒童主題?
查看完整描述

1 回答

?
撒科打諢

TA貢獻1934條經驗 獲得超2個贊

不要覆蓋任何核心文件...相反,您可以使用 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 文件中。它應該有效。


查看完整回答
反對 回復 2023-10-21
  • 1 回答
  • 0 關注
  • 134 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號