WordPress.org

Support

Support » Plugins and Hacks » Scripts n Styles » [Resolved] How to?

[Resolved] How to?

  • The plugin is supposed let me “add custom CSS and JavaScript directly into individual Posts [or] Pages.” Soooo, how do I do that? I expected to see, when editing a page, a field where I could enter scripts or styles. I don’t see that. If I click on Scripts n Styles in the tool menu, there are only options to add CSS and JavaScript globally. So how do I do it on an individual page?

    http://wordpress.org/plugins/scripts-n-styles/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ken Newman

    @wraithkenny

    On the edit screen, under the Screen Options tab, enable the Scripts n Styles metabox 🙂

    I really regret making the box hidden by default. I was hoping to avoid making the edit screen cluttered, by it just confuses people, sorry!

    (A version in the future will have an admin-bar button that opens a modal interface instead of a metabox.)

    Ah, got it now, thanks! One more question while I have you. So, I understand that I enter the scripts without the <script> tags, but how would I enter a script that pulls from an external source? Normally I would enter:
    <script type="text/javascript" src="http://someapis.com/somescript.js"></script>

    But since your plugin includes the script tags, is there any way to add an external script like this with your plugin?

    Thanks again,
    Mike

    Plugin Author Ken Newman

    @wraithkenny

    Use the feature called “Hoops” which creates a shortcode for embedding arbitrary html markup. You’ll end up with something like [hoops name="external-script"] that you’d then put into the post content. If you create the Hoops shortcode on the Settings Page tab, instead of a post edit screen, you can enable hoops in widgets, to use it in a sidebar if you’d like.

    Note: you have to have unfiltered_html (editor or admin user) in order to create a Hoops shortcode, but any user who can use shortcodes will be able to use it.

    Hoops is a cool feature, but I’m not sure it will help me here. In this case, I need the script loaded before the </head> tag, so I don’t think entering a hoops shortcode in the post content would accomplish that, would it?

    Right now I have the script in my header.php file, which is fine, but I don’t really need it loaded on every page, so I was seeking a way to load it only where needed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] How to?’ is closed to new replies.
Skip to toolbar