Sorry I have been so bad with consistent posts lately. I’m working on a couple of WordPress projects that are diverting my attention and which I’ll share with you once they’re up (in beta). Anyway, on one of the current projects I installed the WordPress plugin, AJAXed WordPress, and implemented a trick to compress my CSS stylesheets to decrease load time.
First, AJAXed WordPress is a great plugin that allows you not only to improve usability by decreasing page load times, it also implements some nice JavaScript like animated tricks to dazzle your blog users…sort of. AJAXed WordPress allows for inline paginated posts, inline comments, submitting comments with AJAX, and live comment preview for starters.
For those who haven’t the foggiest idea what AJAX is, in short, it’s a way of building interactive web applications in a way that seems to almost completely get rid of lag time between when you click on something on a web page and when it does what you wand it to do. Google Maps is an example of an AJAXed web application.
I installed AJAXed WP on this website. See how when you click on the “continue reading [name of post here” link on any one of the blog articles on the home page, the rest of the post appears without the rest of the web page having to reload or without having to go to the single post page. Fabulous huh! Install AJAXed WP and play around with it a bit.
I also discovered a nice little trick to compress CSS stylesheets (eliminating white space) so your browsers read the stylesheet faster. Put the following at the very top of your stylesheet (without the quotes):
“<?php if(extension_loaded(‘zlib’)){ob_start(‘ob_gzhandler’);} header(“Content-type: text/css”); ?>”
Put the following at the bottom of your stylesheet:
“<?php if(extension_loaded(‘zlib’)){ob_end_flush();}?>”
Rename your stylesheet by adding the .php extension to the end of it:
If your style sheet name is style.css, rename it “style.css.php”. I’d suggest saving and leaving the original (style.css) as is and wherever it is for future reference as well.
Last, remember to change the reference to the stylesheet’s path in your header:
change:
“<link rel=”stylesheet” href=”http://www.yourwebaddress.com/wp-content/themes/yourtheme/style.css” type=”text/css” media=”screen” />”
to:
“<link rel=”stylesheet” href=”http://www.yourwebaddress.com/wp-content/themes/yourtheme/style.css.php” type=”text/css” media=”screen” />”
I learned of a couple CSS stylesheet compression plugins like css-compress, but this actually gets rid of comment tags that may be in your stylesheets and may be used as necessary hacks to make certain styles show up. If you don’t have any hacks, then it won’t be a problem.
Well, hope some of this helps some of you. Until next time.


10 responses so far ↓
1 David P. // Jan 29, 2009 at 3:32 am
THANKS FOR THE tip.
Going to try this myself.
Cheers!
2 Adney // Jun 19, 2009 at 1:44 pm
this look great.. but you make me confusing.. how we could change css file name to css.php? it will make css don’t be css again and i think we cannot change it to that name.. it still will be css.php.css


may you explain to me?
And i try to explore around your site coding.. no one css.php here.. so do you think it’s work well? you try i first and you done, so you can tell us.. BTW, this is stil great expirement i think..
will come again here soon..
sorry if this comment make you hurt and sorry for my english..
-Adney-
3 Leslie Bourke // Aug 5, 2009 at 5:54 pm
AJAXed WordPress is great! I wish it was a little better documented though.
4 wppad // Aug 9, 2009 at 5:14 pm
Yeah, I know what you mean.
5 hVKONNIE // Feb 17, 2010 at 3:46 am
Various spheres of life utilize lots of time and efforts, hence why should we expend life time for argumentative term paper writing? This would be easier to use some custom writing service to purchase the term paper thesis at, I opine.
6 an essay // Sep 3, 2010 at 2:20 pm
A lot of students prefer to buy essay at the paper writing service about this post.
7 academic writing // Sep 3, 2010 at 2:21 pm
that is so pretty! what a fantastic idea.
8 essay writing services // Sep 4, 2010 at 8:13 am
Looks great! What a wonderful and creative idea
9 dissertation writing // Sep 4, 2010 at 8:15 am
I really LOVE it!!!!!
10 academic papers // Sep 5, 2010 at 1:35 pm
Thanks for sharing. Its really great.
Leave a Comment