This topic has 8 replies, 3 voices, and was last updated 9 years, 11 months ago ago by Eva Kemp
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?
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.
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?
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.
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
Hello @SeemanProductions,
Please create a ticket at http://support.8theme.com/ and our developers will look into your issue.
Thank you.
Regards,
Eva Kemp.
Dear Eva,
I’ll do it, thank you for your help.
Hello,
You’re welcome.
Regards,
Eva Kemp.
Tagged: javascript, load, optimize, templates, woocommerce, wordpress
The issue related to '‘Need to load a javascript’' has been successfully resolved, and the topic is now closed for further responses