简体   繁体   中英

how to add the script to the wordpress page

I am trying to create the appear and disappear effect as found on this page http://dante.swiftideas.net/developer-documentation , there are three scripts getting fired jquery-1.9.1.js, jquery-ui.js and then there is a third script without a name. So how to add the third script to a specific wordpress page?

use the wp_enqueue_script() function inside your theme's functions.php - it's meant to be used for this purpose. If you only want this script to load on a single specific page, then you can wrap the wp_enqueue_script function with a conditional to check if it's that specific page (by the page's ID in wordpress):

if (is_page(123)) {
    function theme_name_scripts() {
        wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); }
    }
    add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM