Correct usage of scripts with shortcodes
Scripts which are very specific to shortcodes can be loaded directly inside the shortcode and do not have to be registered through the wp_enqueue_scripts hook. This has the advantage of you do not need to run extra code and checks to load the script conditionally, so the has_shortcode() check can be dropped. There is also … Read more