Excellent plugin for themes that don't have a custom CSS field
-
This is great for getting down and dirty with the styles of themes that don’t offer enough customization options to make my brother happy. I’m done editing the style.css for themes like that because it prohibits easy updating. Now I have a better option: __PLUGIN__
I did notice that it made no difference if I checked the “credit box” or not fyi.
My only suggestion is to make it so there are two options, based on my study of page load times:
- Head written CSS
- Static CSS file
The way you have now is not too bad, but it does cause significant page load delay. On my server, it takes between 500 and 900 milliseconds of ‘waiting’ before it downloads the CSS. The server needs to include and parse every file that the WordPress installation is running before it gets to your script. To prove this, simply swap out the sccss_trigger_check function with the following “debug” function:
function sccss_trigger_check() { if( intval( get_query_var( 'sccss' ) ) == 1 ) { //ob_start(); header('Content-type: text/css'); $options = get_option( 'sccss_settings' ); $raw_content = isset( $options['sccss-content'] ) ? $options['sccss-content'] : ''; $esc_content = esc_html( $raw_content ); $content = str_replace( '>', '>', $esc_content ); if ( isset( $content ) ) { echo "/* * Created by the Simple Custom CSS Plugin * by John Regan (http://johregan3.me) * http://wordpress.org/plugins/simple-custom-css/ */\n\n"; } //echo $content; var_dump(get_included_files()); echo ' '; function convert($size) { $unit=array('b','kb','mb','gb','tb','pb'); return @round($size/pow(1024,($i=floor(log($size,1024)))),2).' '.$unit[$i]; } echo convert(memory_get_usage(true)); exit; //ob_clean(); } }
On my setup, we’re talking 173 PHP script includes and 20.25 MB of memory!!
So if you have it fwrite() a sccss_styles.css file when we click “save changes” we’d have a lot less load on the server and quicker downloads.
- The topic ‘Excellent plugin for themes that don't have a custom CSS field’ is closed to new replies.