Here is a funny plugin. All it does is actually give you the opportunity of adding a small widget on the sidebar to display the latest LolCat from ICanHasCheezburger. If you don’t already know what a lolcat is then please visit their about page. Also, the Wikipedia article is very enlightening. Now to the point.
This simple plugin retreives the latest lolcat and displays it on a widget. It caches it for two hours so it won’t slow up the process of loading each time.
You need to make sure of two things:
Download the plugin from here: Lolcats Widget (2299) - 9.2 KB. In there you will find the folder lolcats_widget. Just copy the whole folder in your plugins directory. Go to your administration and activate the plugin. Finaly, place the widget where you want it on the sidebar.
Because i don’t know wether this plugin will be even remotely usefull to anyone i didn’t bother creating any settings page or settings on the widget setup. If i see it is indeed usefull i’ll go on and do it (why don’t you drop a comment on the post “voting” for further development). For now, you can tweak it from within the code (no, do not worry, i’ll show you where and what). Just open the file “lolcats_widget/lolcats_widget.php” with your favorite text editor (i recommend notepad++) and go ahead…
Changing some settings
When you open it, please notice this area (from line 14 to 19):
Now, as you can see some of the “behavioral” settings are defined here. Change them as you need. For instance if you want the cache to timeout earlier than two hours change the “$cache_timeout” to how many seconds you want. Or, if you want the cache directory to be something else rather than the “cheezes” one change it on the next two lines (for instance “/tmp”). The “final_image_width” is actually the width that the lolcat will have after it is resized. Finaly, “use_blank” is a boolean that indicates whether the lolcats page should open on a new window (_blank) or not. Change it according to your theme.
Tweaking the output
Well if you are a bit more adventurus you can fix the output of the widget anyway you want it. It’s a fairly small plugin but i’ll still guide you guys through this just for those that are not as comfortable. Notice lines 63-72.
This actually is the function that renders the small widget. So let’s say you want to add something after the image. You can write any HTML after line 69. If you want to add it before then shoot between 68 and 69. Pretty easy. And if you still feel uncomfortable just let me know with a simple comment and i’ll get to work to add a small options page.