How many times has this happened to you? You read the full plugin introduction on WordPress.org, look to the heavens and say "Thank You!". Only to find there is one little nuance in the plugin which is a deal breaker.

You're saying to yourself, "Why couldn't they just provide a configuration option for that?" In all truth, this has happened to me many times, and as a developer, can certainly understand the amount of work involved in making absolutely everything configurable.

Often times, with a little PHP experience, you are able to override a plugin template file, but other times you are forced to make changes to the plugin itself. As all WordPress developers know, this is not a future-proof solution. While it may provide the temporary relief you need, an upgrade to your plugin will wipe out any changes you employed.

In this case, if your change is minor and mostly presentational, you might consider a JavaScript / jQuery solution.

Let's take for example, an issue I had with the WP Portfolio plugin. While I love the plugin, it did one little thing the irked me. When it could not produce a thumbnail for a given website, it used the ugliest placeholder known to man.

Normally, I would simply replace the JPEG used for the thumbnail. But, I wanted to use a PNG for the transparency. There was no apparent way to do this in the configuration options, so I resorted to a jQuery solution:

$('.website-thumbnail img').each(function() {
    if($(this).attr('src').indexOf('thumbnail_blank_lg.jpg') >= 0)
        $(this).attr('src', $(this).attr('src').replace('.jpg', '.png')).css('border', 0);
});

The simple code above allows me to break free of any hard coded, impossible to track down piece of code, which almost made a great product useless to me. Thank you JavaScript and jQuery!

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *