Support » Plugins » Add script and css to header from withing shortcode

  • Hi,
    Trying to write a plugin. Would like to use wp_enqueue_script and wp_enqueue_style on init from within my plugins shortcode.
    Is there a way to add css and javascript to page header from within a shortcode?

    Anything pointing me in right direction is highly appreciated!


Viewing 1 replies (of 1 total)
  • Hi,
    in the case of javascript it will be a better solution to load it in the footer. And based in a shortcode you will not be able to load anything in the header because the page will be processed in the following order:
    2.body(here will be the shortcode)
    So you when you will trigger the action by shortcode, the header it will be already processed.
    If you are interested study this page : and you can check out my plugin based on that page. The plugin name is: activator.
    About CSS cant tell you much, currently I do some studies about it.
    best regards

Viewing 1 replies (of 1 total)
  • The topic ‘Add script and css to header from withing shortcode’ is closed to new replies.