Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

How to enqueue script / style from shortcode static file based on shortcode parameter?

Open dk-wordpress opened this issue 11 years ago • 1 comments

Hello!

Is it possible to enqueue script or style from shortcode static file based on shortcode parameter? I mean something like this:

if( $atts['shortcode_param'] == 'foo') {
    wp_enqueue_style( 'style-foo');
} elseif( $atts['shortcode_param'] == 'bar' ) {
   wp_enqueue_style( 'style-bar');
}

thanks for advice :)

dk-wordpress avatar Nov 05 '15 15:11 dk-wordpress

http://manual.unyson.io/en/latest/extension/shortcodes/index.html#enqueue-shortcode-dynamic-css-in-page-head

ghost avatar Nov 05 '15 15:11 ghost