This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Reply To: Mailpress and news scroller plugin

#558
Jason Bobich
Keymaster

No worries, I understand. But this is something you’ll definitely want to learn. It’s one of those things that’s specific to WordPress so can be confusing at first if you’ve never worked with scripts specifically in WordPress.

So, I noticed it looks like you’re using the default Child theme that I included with the theme. So for example, you’d take your jquery.maphilight.min.js file and place it in the /assets/js/ folder of your Child theme.

Now from the functions.php, of your Child theme you’d include it like this:

function my_scripts() {
    wp_enqueue_script( 'maphilight', get_stylesheet_directory_uri() . '/assets/js/jquery.maphilight.min.js', array('jquery') );    
}     
add_action( 'wp_enqueue_scripts', 'my_scripts' );

Note that the 3rd parameter in the wp_enqueue_script function is the $deps parameter which stands for dependencies. This is where you can put in an array of scripts need to be loaded before the script your enque’ing. In this case you have one script you need to be loaded before, which is jQuery.

http://codex.wordpress.org/Function_Reference/wp_enqueue_script

The reason you do it all like this is because all plugins and the theme are essentially putting all of the javascript files into a queue and then WordPress is displaying them all together in a way that abides by the dependencies of each file and without having multiple instances of the same file.