wp_enqueue_script page speed help
-
Hello I am looking at being able to only run the js required for OpenTicket when it is on the correct pages like the calendar and the events. I believe you can do this by adding a function to functions php like so:
// Call the function function geoffgraham_enqueue_stuff() { // Specify the conditional tag if ( is_page( 'new-page' ) ) { // If page matches, then load the following files wp_enqueue_style('new-styles.css', get_template_directory_uri().'/path/to/new-styles.css', false ,'1.0', 'all' ); wp_enqueue_script('new-scripts.js', get_template_directory_uri().'/path/to/new-scripts.js', false ,'1.0', 'all' ); // If the condition tag does not match... } else { // ...then load the global files instead wp_enqueue_style('style.css', get_template_directory_uri().'/path/to/style.css', false ,'1.0', 'all' ); wp_enqueue_script('scripts.js', get_template_directory_uri().'/path/to/scripts.js', false ,'1.0', 'all' ); } } // Hook into the WordPress Function add_action( 'wp_enqueue_scripts', 'geoffgraham_enqueue_stuff' );
but i see in the code files I have checked that there are register_script and admin_enqueue_script. Could you tell me which wp_enqueue_script I need to use?
Many Thanks
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘wp_enqueue_script page speed help’ is closed to new replies.