Shortcodes and AJAX content

Some themes and plugins may load your content using AJAX requests. In this case, shortcodes may not work properly, because wp_head and wp_footer hooks will not be triggered after the content load. This means that necessary shortcode assets (javascript and stylesheets) will not be loaded.

You can force loading of necessary assets on every page of a website. Add the following code to the end of the functions.php file of your active theme:

function PREFIX_su_force_assets() {

	if ( ! function_exists( 'su_query_asset' ) ) {

	// Force loading of Stylesheets
	su_query_asset( 'css', 'su-shortcodes' );

	// Force loading of JavaScripts (remove unwanted scripts)

	// Slider, carousel, etc.
	su_query_asset( 'js', 'su-galleries-shortcodes' );

	// Audio, video, etc.
	su_query_asset( 'js', 'su-players-shortcodes' );

	// Spoiler, accordion, tabs, etc.
	su_query_asset( 'js', 'su-other-shortcodes' );


add_action( 'wp_head', 'PREFIX_su_force_assets' );

Look for the complete list of available assets here:  /wp-content/plugins/shortcodes-ultimate/inc/core/assets.php:94 .