Scripts n Styles
[resolved] How to? (5 posts)

  1. Mike
    Posted 2 years ago #

    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?


  2. Ken Newman
    Plugin Author

    Posted 2 years ago #

    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.)

  3. Mike
    Posted 2 years ago #

    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,

  4. Ken Newman
    Plugin Author

    Posted 2 years ago #

    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.

  5. Mike
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Scripts n Styles
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.