Enqueue scripts – again
-
I know this has been asked about a million times. I’ve searched and gone through guides and instructions on how to do this for days and I’m clearly still doing something wrong. My jquery just won’t work. I’ve tried following instructions for registering and enqueueing the scripts, and instructions for wrapping the jquery, etc. Nothing seems to help. So I’m hoping that if I show you my code for enqueueing the script, you can tell me what is wrong. I’ve tried several different instructions for enqueueing it and apparently, I just can’t wrap my brain around it.
Here is my code:
function duckstyles()
{
wp_enqueue_style( ‘style’, get_template_directory_uri() . ‘/style.css’ );
wp_register_script( ‘duckapp’, get_template_directory_uri() . ‘/duckapp.js’, __FILE__, array( ‘jquery’ ), 1.0, true);
wp_enqueue_script( ‘duckapp’, get_template_directory_uri() . ‘/duckapp.js’, __FILE__, array( ‘jquery’ ), 1.0, true);
}
add_action( ‘wp_enqueue_scripts’, ‘duckstyles’ );my js file is located in the same directory as the functions.php file, the main theme directory. The CSS works. The only javascript I have for the wordpress page is a script that changes the header’s class when you scroll down on the page. It worked fine before I started trying to enqueue the scripts. I feel bad asking about something that has been posted so many times, but apparently I lack the ability to follow the instructions in the various websites and other posts. :/
Thanks.
- The topic ‘Enqueue scripts – again’ is closed to new replies.