Support » Plugins and Hacks » [Shortcodes in Own Plugin] – Loading CSS and JS

  • Resolved Luigino


    Hello everyone!!!!

    I implemented my own plugin where I added also a shortcode’s function to load some content in a page from the plugin.
    I have this little issue:

    <script src="../wp-content/plugins/myownplugin/js/myscript.js" type="text/javascript"></script>

    I can see it isn’t really a good solution since plugin’s name could change so I tried with echo plugins_url(‘js/myscript’); but while debugging with Firebug I figured it didn’t return the REAL path of the script but the PAGE url + /%3C?php%20echo%20plugins_url(%27js/myscript.js%27,%20dirname(%20__FILE__)%20);%20?%3E”…

    How I can get this plugins_url work?..

    thanks a lot in advance to everyone


Viewing 1 replies (of 1 total)
  • Nevermind… solved by myself:

    practically BEFORE to load the contents from html/php file I call plugins_url() so I can get correctly the whole url, then I replaced with str_replace() a constant in the content with the plugin url so I can feel ok.

    Thanks again to all anyway

Viewing 1 replies (of 1 total)
  • The topic ‘[Shortcodes in Own Plugin] – Loading CSS and JS’ is closed to new replies.