I want to include a script in a shortcode output, so I am trying this:
function my_shortcode( $atts, $content = null ) {
extract(shortcode_atts(array(
'title' => '',
), $atts));
wp_enqueue_script('custom-script');
}
I have registered the script already and enqueue it if the above shortcode is used. However I want to include the file only once, even if the shortcode is used multiple times. Currently, if the shortcode is used multiple times, it will include the script for each time. Is it possible?