Posts tagged “php”

Extend notification emails in wp-e-commerce

The wp-e-commerce shopping cart plugin is probably the most popular cart plugin for WordPress, but it isn't always the most easily customised; in fact, theming it can be a nightmare. One little niggle I had to fix recently was that the notification emails don't include relevant purchase information such as which shipping method was selected, or the per-item comments from the purchaser (e.g. a message to be included inside a book flap).

Conditionally disable Pages Children in WordPress

Whilst WordPress might be a very easy tool for managing website content, and is making great inroads into the CMS market, it isn't very convenient for editing large numbers of pages on a very large website. That's where the Pages Children plugin comes to the rescue, breaking the page administration lists down into a nice, manageable hierarchy. But it doesn't play nice with another great WordPress plugin, Role Scoper, which is also likely to be installed on large websites. Hooks to the rescue!

Filter documents in WordPress media library

The WordPress media library has a few nice features for managing uploaded files. One thing it doesn't do is make it easy to find documents. It makes it easy to filter all the files to list only the images, or video, or even audio files, but not documents like PDFs, Word documents, spreadsheets etc. But adding a Documents link to the media library is just a few lines of code away.

Simple URL cleanser in PHP

There are lots of ways to tidy up a URL to remove "special" characters. Some do more than others, some purport to do a lot but really don't do much. Some, like WordPress' sanitize_title_with_dashes, throw six or more regular expressions and a couple of multi-byte string conversions at your string but don't handle accented characters. Here's a simple one that does convert accented characters.

Minify CSS on the fly

Keeping your website content as small as it can be so that it downloads fast is as important today as it was back in the pre-broadband days, given that you don't know whether your visitors will be accessing your websites via broadband, dialup, or mobile connections. As CSS files grow, it can be as important to minify them to trim the fat as it is for JavaScript downloads. Here's how I do it on-the-fly for CSS.

Autocomplete in WordPress plugin admin

I just had to find a way to add autocomplete to an admin screen for a WordPress plugin I'm writing. Although a few pieces of jQuery UI are bundled into the WordPress distribution, that doesn't include jQuery UI autocomplete. But on the way to investigating how to drop that into my plugin, I discovered that WordPress does bundle in a similar, simpler plugin called jquery.suggest.