0

I have attempted with the below but it crashed the system.

<?php

    wp_register_script( 'support', 'js/big-support.js', );
    wp_enqueue_script( 'support' );

/* */
?>

1 Answer 1

1

Firstly, enable debugging when developing in WordPress.

// wp-config.php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true); 

That will help you find the cause of errors.

Probably this line is the problem. older versions of php do not allow for trailing ,'s in function calls

wp_register_script( 'support', 'js/big-support.js', );
                                               // ^  remove comma

Secondly, you should use the wp_enqueue_scripts hook when registering scripts like so:

add_action('wp_enqueue_scripts', 'SO_53028038_register_scripts');
function SO_53028038_register_scripts(){
     wp_enqueue_script('support', get_stylesheet_directory_uri() . '/js/big-support.js';          
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.