WordPress.org

Ready to get started?Download WordPress

Forums

Bug Library
Proper load of CSS (3 posts)

  1. Austin Passy
    Member
    Posted 3 years ago #

    Just getting your plugin installed, but I'm going to have to midify it a bit. You've loaded your CSS files onto every single page. Quite a waste of bandwidth.

    You might want to implement this snippet: http://wordpress.stackexchange.com/questions/2302/loading-scripts-only-if-a-particular-shortcode-or-widget-is-present to only load your scripts on the page with your shortcode.

    http://wordpress.org/extend/plugins/bug-library/

  2. Austin Passy
    Member
    Posted 3 years ago #

    I take that back. I just took a look at the code, and then saw the additional stylesheet (which still gets added to all pages).

  3. Austin Passy
    Member
    Posted 3 years ago #

    Also, off topic. But the CSS added to the head should be compressed in some manner. Again for speed.

    Try:

    echo "<style id='BugLibraryStyle' type='text/css'>\n";
    			$css = stripslashes($genoptions['fullstylesheet']);
    			$css = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $css);
    			/* remove tabs, spaces, newlines, etc. */
    			$css = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), '', $css);
    			echo $css;
    		echo "</style>\n";

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic