Execute js files doesn’t seem to work
Just hook to wp_enqueue_scripts for both registering and enqueueing. You’ve registered with in_footer (last parameter in your code) true so what you need is: function print_my_royal_slider_script() { global $add_my_script; if ( ! $add_my_script ) return; wp_enqueue_script(‘my-script’); } add_action (‘wp_enqueue_scripts’, ‘print_my_royal_slider_script’); The problem is going to be with $add_my_script. That has to be set before wp_head … Read more