Posts tagged “hacks”

Repair WordPress image meta

There are times when things just go wrong. I had one of those times the other day. The pressure was on to deliver a project, and there were bits of PHP and CSS and JavaScript flying everywhere here at WebAware Central. And so it happened: I wiped the image attachment meta data in the WordPress database.

How to hack a WordPress plugin that doesn’t have the filters you want

The best thing about WordPress, besides the fact that nearly anyone can edit a website built with it, is hooks. Filter and action hooks allow developers like me to customise a WordPress website in myriad ways. Many good plugins provide hooks too. But inevitably, you'll run up against a problem where you'd like a plugin to have a hook that it just doesn't have. You can ask the plugin author nicely to add that hook, and maybe they'll add it sometime soon, maybe even on time for your deadline. But what if your deadline comes before they add it?

Cleaning up WordPress plugin script and stylesheet loads over SSL

It's quite common to use WordPress as the host for an online shop, and that often means having an order page that needs to be encrypted via SSL. You don't want your customers providing credit card details or other sensitive information over an unencrypted connection! But many WordPress plugins don't take SSL into account, and merrily load scripts and stylesheets without encryption. Here's a couple of ways to fix this problem.

Make CSS drop-down menus work on touch devices

CSS drop-down menus are very popular on sites with a hierarchy of pages. They let you get to where you want to go without having to navigate the pages in that hierarchy. But pure-CSS menus suffer a problem: touch devices often can't show the drop-down, because they don't have "hover" and clicking on the top level link goes there. This snippet offers a way around that.

Feature sniffing Internet Explorer

Pretty much all web developers should know by now that browser sniffing is evil. If you don't know why, you should definitely read Richard Cornford's excellent treatise Browser Detection (and What to Do Instead). Feature detection, where you look for the specific feature you want to use, is much safer; taken to the extreme, it can end up like the rather clever Modernizr project. But what if you really do just want to know if your code has the misfortune to be running on IE7?

CSS3 linear gradients and Internet Explorer

CSS3 has been tempting me with linear gradients for a while now. They don't work in Internet Explorer, but there are ways and means with a little script magic. Now that Opera has finally joined the party, I figured it was time to ditch those ever pervasive linear gradient background images and start using CSS3 for linear gradients. But it's not all rosy, especially when you need to position your background.