Category Archives: Wordpress

Language that does not complain -> confusing bugs

Today I had to debug a clients site.

You see, the slider was broken.

Why?

The slider javascript wasn’t being loaded.

Why?

The entire lower portion of the html is non-existent.

Even the caching plugin’s status information is missing.

The html’s last words were “<!– mfunc”, a harmless comment. Let’s pay attention to where the comment was.

It was where the sidebar should have been.

Let’s look in the sidebar template file.

That’s odd, the template uses a special php function that stops php from sending the html to the browser until you call a second special function.

Maybe a bug is stopping this second function from being called.

Let’s add other random comments to see if they show up.

They do. Thus it cannot be the special function.

So what is it? Lets see what the supposedly harmless comment is.

It’s magic.

Or that is to say, it is way for a plugin to run code indirectly if the site is being cached.

All added with a wordpress hook, a way for a plugin to indirectly run code during html generation.

Yes! A plugin is indirectly-indirectly running code, and this code is crashing.

And that is the real bug.

I just wish finding it was quicker.

WP UpdateAssistant launch

WordPress upgrades can be annoying. The upgrade itself is painless and wordpress devs have clearly put a lot of time and effort to make it so. The annoyance instead comes from the last one percent of the difficulty inherit in upgrading software. No matter how well the devs design, at the end of the day you have to manually initiate the upgrade.

Compared to what users of other content management systems have to go through to upgrade the complaint is perhaps petty. Still, if you have ten or more installs of wordpress to upgrade the monotone starts to get to you.

That is my motivation behind WordPress UpgradeAssistant

Once a webmaster has added their domains, UpgradeAssistant will check for outdated wordpress installs and highligh them in red. A link is provided directly to the wordpress upgrade panel for convenience.

No registration is required as everything is done client side.

Any bug reports, comments, or suggestions are much appreciated.

WP Markerboard Widget

I’ve seen this ‘toy’ elsewhere and after debugging Overview generation for foomatic I felt a quick break was in order so this morning I created WP Markerboard. It is a WordPress plugin that provides a “marker board” widget for visitors to play with. I built it using html5’s canvas element and jQuery.

An example can be seen below, try moving your mouse over the outlined box.

Being an html5 toy your browser must of course support the canvas element. For visitors without modern browsers the javascript fails gracefully.

The widget has four options, line color, line width, box width, and box height. Unfortunately canvas requires explicit dimensions, the default dimensions for Markerboard are 150px by 150px.

To install unzip the zip and ftp the resulting folder into your wp-contet/plugins/ directory. The plugin will then show up in WordPress’s list of plugins, active it, you may now add this widget to your sidebars.
Or simply install from wordpress’s add new plugin page as wp markerboard is hosted on wordpress.org’s plugin repository.
See WP Markerbaord on wordpress.org

WordPress XML-RPC documentation links

Unfortunately the documentation for WordPress’ XML-RPC API only covers the WordPress specific extensions. As such if you want to do anything useful you’ll have to seek help else where. Perhaps the most important thing to note is that WordPress supports Metaweblog a proper open standard.

During my google’ing I came accross several helpful links:

Attaching an image to a post:

One thing that was absolutely un-documented was a method to attach an image to a post. After some digging I found attach_uploads() which is a function that wordpress calls every time a post is created or edited over xml-rpc. What it does is search through the list of un-attached media objects and see if the new/edited post contains a link to them. Since I was trying to attach images so that the theme’s gallery would use them I didn’t necessarily want to link to the images within the post, nor did I want to edit wordpress. So what I ended up doing was including the image url within an html comment.