I think $scr
in your wp_register_script() function is not correct. As your functions.php is inside your plugin, and removeArrows.js is in the root of your plugin, your $scr
should look like this
plugins_url( '/removeArrows.js' , __FILE__ )
It's good practise to load your scripts and styles in last. This will ensure that other scripts and styles don't get overridden. For this simply add a very low priority to your priority parameter (very high number)($priority)``
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts', 999 );
One more thing always loads/enqueue scripts and styles via the wp_enqueue_scripts
action hook, this is the correct hook to use. Don't load scripts and styles directly to wp_head
orwp_footer
Now as you've indicated that you moved everything to your theme, your $scr
would change to this
get_template_directory_uri() . '/removeArrows.js'
Use this for parent themes
get_stylesheet_directory_uri() . '/removeArrows.js'
`You can use this code for child themes.
function wpb_adding_scripts() {
wp_register_script('my_amazing_script', get_template_directory_uri() . '/removeArrows.js', array('jquery'),'1.1', true);
wp_enqueue_script('my_amazing_script');
}
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts', 999 );