第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在 Elementor (Pro) 中取消注冊(cè)/出隊(duì) jquery.sticky.js?

如何在 Elementor (Pro) 中取消注冊(cè)/出隊(duì) jquery.sticky.js?

PHP
慕斯709654 2021-11-26 16:12:10
我想通過(guò)注銷(xiāo)不必要的外部資源來(lái)提高頁(yè)面速度。我已經(jīng)設(shè)法刪除了大部分外部腳本,Elementor 默認(rèn)在前端加載。但是,我無(wú)法以某種方式刪除 jQuery 插件Sticky。我想這與成為 Elementor Pro 的一部分有關(guān)。我已經(jīng)嘗試查看 jQuery 依賴(lài)項(xiàng),但這對(duì)我不起作用。function remove_jquery_sticky() {    if ( ! is_admin()) {        wp_deregister_script( 'sticky' );    }}add_action( 'elementor/frontend/after_register_scripts', 'remove_jquery_sticky' );I expect the jQuery plugin not to load on the frontend, however it still does.
查看完整描述

3 回答

?
素胚勾勒不出你

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超9個(gè)贊

Elementor 和 Elementor PRO 注冊(cè)和排隊(duì)一些具有依賴(lài)關(guān)系的腳本。對(duì)于刪除,您需要在沒(méi)有特定腳本的情況下取消注冊(cè)并再次注冊(cè)(例如沒(méi)有“elementor-sticky”)。


if(is_front_page()) {


        // Dequeue and deregister elementor-pro-frontend

        wp_deregister_script( 'elementor-pro-frontend' );


        // Re-register elementor-frontend without the elementor-sticky dependency.

        $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';

        wp_register_script(

                'elementor-pro-frontend',

                ELEMENTOR_PRO_URL . 'assets/js/frontend' . $suffix . '.js',

                [

                    'elementor-frontend-modules',

                ],

                ELEMENTOR_VERSION,

                true

            );

    }

}

add_action( 'wp_enqueue_scripts', 'elementor_pro_frontend_scripts', 20 );


查看完整回答
反對(duì) 回復(fù) 2021-11-26
?
茅侃侃

TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超22個(gè)贊

我找到了一個(gè)適合我的解決方案。如果您有更清潔的解決方案,請(qǐng)告訴我:)


    if(is_front_page()) {

        // Dequeue and deregister elementor-sticky

        wp_dequeue_script( 'elementor-sticky' );

        wp_deregister_script( 'elementor-sticky' );


        // Dequeue and deregister elementor-pro-frontend

        wp_dequeue_script( 'elementor-pro-frontend' );

        wp_deregister_script( 'elementor-pro-frontend' );


        // Re-register elementor-frontend without the elementor-sticky dependency.

        $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';

        wp_register_script(

                'elementor-pro-frontend',

                ELEMENTOR_PRO_URL . 'assets/js/frontend' . $suffix . '.js',

                [

                    'elementor-frontend-modules',

                ],

                ELEMENTOR_VERSION,

                true

            );

    }

}

add_action( 'wp_enqueue_scripts', 'elementor_pro_frontend_scripts' );```


查看完整回答
反對(duì) 回復(fù) 2021-11-26
?
鴻蒙傳說(shuō)

TA貢獻(xiàn)1865條經(jīng)驗(yàn) 獲得超7個(gè)贊

如果您知道正在添加的操作的名稱(chēng),您可以使用該功能,remove_action( $tag, $function_to_remove, $priority )或者您可以使用wp_dequeue_script( $handle )

https://codex.wordpress.org/Function_Reference/remove_action

https://codex.wordpress.org/Function_Reference/wp_dequeue_script


查看完整回答
反對(duì) 回復(fù) 2021-11-26
  • 3 回答
  • 0 關(guān)注
  • 213 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)