Oct 12 2010

From Plain To Recursively Interesting

Category: WordPressChrisM @ 2:55 am

In the last of today’s posts on WordPress plug-ins, I wanted to take a quick look at a very versatile stack of code. The Executable PHP widget plug-in makes it possible (in many cases) to create a brand new type of widget without having to write an entire plug-in to create it. Obviously you can create widgets that display text or images with just a default installation of WordPress, however if you want to use some PHP code to create a dynamic area that reacts differently according to some variables, or actually has some code to process, you would normally need to get your hands pretty dirty and either actually write a plugin to backup the displaying of this section, OR hardcode it into your template’s sidebar.
The first involves too much work for me (DanD is the coder amongst my friends here, I’m a bodger when it comes to software creation), and the second isn’t ideal if you upgrade or completely change your theme – you need to remember to keep a record of your changes, and re-integrate them into the new theme’s files.
So, by placing a widget in your sidebar that is allowed to contain PHP code that will be run, you can suddenly do a lot more with your site, very easily. At one point, about three years ago, I had a lot of widgets that used this system, however I eventually managed to realise that load times were more important than having every possible bell and whistle integrated on the front page. That said, if you run a blog dedicated to digital cameras, and simply want to run a little script that pulls in information on the latest models’ zoom levels or ISO speeds, or perhaps grab the best live prices for huge memory cards, the possibility is there for you. The recursive reference? PHP stands for PHP: Hypertext Preprocessor…

Tags: , ,