get_stylesheet_directory_uri() . ‘/js/custom_script.js’,
array( ‘jquery’ )
);
}
add_action( ‘wp_enqueue_scripts’, ‘my_scripts_method’ );
?>
This code is used to load a custom script in wordpress. The script is loaded using the wp_enqueue_script function. This function takes 3 parameters. The first is the name of the script. The second is the path to the script. The third is an array of dependencies. In this case, the script is dependent on jquery. The script is then loaded using the add_action function.
Was this code snippet helpful?
YesNo