Create your first Widget for WordPress – Intro

As you can see this blog is hosted using WordPress 2.3 engine.
Aside from being free and all, it provides you with easy way to extend it using Widgets.
There is a long list of widgets created by different people over the time and you can find almost anything.
Well… almost… when it comes to personal preference especially a programmer, we might became very picky and I am not an exclusion from this.

I was looking for the widget which will allow me to integrate an ImageBlock from my Photo Gallery into a side bar and I have not find something which will satisfy me all the way.

If you are familiar with Menalto Gallery 2 Engine, then you might know what ImageBlock is a simple preformatted PHP code snippet which you can put in your site’s PHP code to inject HTML showing random (or other kind) of item from your photo collection. In addition you need to include reference to the stylesheet file into the header.
All configuration options are translated into query parameters which are then used by the snippet.
Good, nice, easy… except that WordPress does not allow to use PHP inside your Text Widget, neither there is some very simple widget available around which will allow you do such thing easy way. I am sure there is one but I have not found one up to this moment.

As a result I end up using IFrame for some time with external page embedded. Not very nice solution since IFrame is not to XHTML validator friendly when it comes to transparency and is not auto-sizable without dancing with JavaScript…

After finishing some design work with my blog layout I have decided it is time to create my first Side Bar Widget for WordPress and it happened to be a PHPText.

This entry was posted in Web-design and tagged , , . Bookmark the permalink.

Leave a Reply

%d bloggers like this: