Fixed wp_register_script call

`wp_register_script` was being called at the wrong time, added action to call at the proper time.