WordPress.org

Ready to get started?Download WordPress

Forums

Selectively loading plugin stylesheet on posts (4 posts)

  1. exchequer598
    Member
    Posted 3 years ago #

    Using the Syntax Highlighter Compress plugin, it adds a good ~10KB worth stylesheets (not considering the JS) to all post pages. How do I load the stylesheets and the scripts only on the pages that I actually use the plugin?

  2. Steffen Jørgensen
    Member
    Posted 3 years ago #

    You could ad a tag to pages that includes code to be highlighted, and do a <?php if_has_tag('highlight'); ?> to load the CSS/JS files.

  3. exchequer598
    Member
    Posted 3 years ago #

    It doesn't use the wp_script_enqueue or the wp_script_dequeue methods!

  4. exchequer598
    Member
    Posted 3 years ago #

    I'm just gonna use your suggested method for the SyntaxHighlighter Evolved plugin! Thanks :-)

Topic Closed

This topic has been closed to new replies.

About this Topic