Need to load a javascript - by Hunchback

This topic has 8 replies, 3 voices, and was last updated 9 years, 11 months ago ago by Eva Kemp

  • Avatar: Hunchback
    Hunchback
    Participant
    November 15, 2014 at 09:54

    Hello,

    I am trying to load a javascript that adds a snow effect on our site. I tried editing the head.php file and simply adding the <script src=”snowstorm.js”></script> code, as suggested by the script author, but this didn’t work. I then looked up info on loading scripts and tried editing functions.php with the following code:

    
    <?php
    define('ETHEME_DOMAIN', 'legenda');
    require_once( get_template_directory() . '/framework/init.php' );
    
    function wpb_adding_scripts() {
    wp_register_script('snowstorm', plugins_url('snowstorm.js', __FILE__), array('jquery'),'1.1', false);
    wp_enqueue_script('snowstorm');
    }
    
    add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' );
    
    ?>

    But it didn’t work either. Could you help?

    7 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    November 15, 2014 at 11:50

    Hello,

    In this case you need contact developers. Please create a ticket at http://support.8theme.com/ and provide your wp-admin panel and FTP credentials in there.

    Thank you.
    Regards,
    Eva Kemp.

    Avatar: SeemanProductions
    SeemanProductions
    Participant
    January 5, 2015 at 16:25

    Hi!

    Could you please help me how can I call jQuery in Legenda child theme due to function.php?
    I use this code, but when I check it in Developer Tool’s resources, I could find it.

    `<?php
    // Exit if accessed directly
    if ( !defined(‘ABSPATH’)) exit;

    /* Add custom functions below */

    add_action( “wp_enqueue_scripts”, “my_script”);

    function my_script()
    {
    wp_enqueue_script(
    ‘my_script’,
    get_stylesheet_directory_uri() . ‘/js/theme.js’,
    array( ‘jquery’ ),
    ‘1.0’,
    true
    );
    }

    What did I wrong?

    Avatar: Eva
    Eva Kemp
    Support staff
    January 5, 2015 at 16:43

    Hello,

    Please read WordPress documentation how to add js script to a child theme:
    http://codex.wordpress.org/Function_Reference/wp_enqueue_script

    Thank you.
    Regards,
    Eva Kemp.

    Avatar: SeemanProductions
    SeemanProductions
    Participant
    January 5, 2015 at 16:52

    Dear Eva,

    Thank you for quick response. Of course I found a lot of resource from the Google, I spent hours to get it to work, but I didn’t find solution, this is why I requested help from you.
    Please help me.

    Thank you in advance

    Avatar: Eva
    Eva Kemp
    Support staff
    January 5, 2015 at 17:09

    Hello @SeemanProductions,

    Please create a ticket at http://support.8theme.com/ and our developers will look into your issue.

    Thank you.
    Regards,
    Eva Kemp.

    Avatar: SeemanProductions
    SeemanProductions
    Participant
    January 5, 2015 at 17:13

    Dear Eva,

    I’ll do it, thank you for your help.

    Avatar: Eva
    Eva Kemp
    Support staff
    January 5, 2015 at 17:30

    Hello,

    You’re welcome.

    Regards,
    Eva Kemp.

  • Viewing 8 results - 1 through 8 (of 8 total)

The issue related to '‘Need to load a javascript’' has been successfully resolved, and the topic is now closed for further responses

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.