WordPress Custom Page Templates (or How I Solved the Issue of the Mystery Content)

WordPress custom page templates are very easy to create; so easy, in fact, that it was recently causing problems with a website I administer.

Read More

Logging User Connections in MySQL

At the company where I work, my predecessor made a number of questionable choices. One of those was giving far too many privileges to users in MySQL. He created many users specifically to connect to a single database, but gave those users root-level access to the system. Yikes! Fixing this was easy enough, but identifying which databases users actually needed access to was sometimes a challenge.

Read More

Creating Smarter Forms Using Geolocation

Geolocation can be used to pre-select a country from a drop-down menu

Every country in the world, and the U.S. is near the bottom of the list. We could use geolocation to pre-select it for U.S. users.

I was filling out a form online recently, and one of the questions was “country.” As I scrolled through a seemingly endless drop-down list—one that contained every country in the world—I lamented aloud that “United States” wasn’t right at the top. That’s when it hit me: We have reasonably accurate IP-based geolocation services available, so why not attempt to figure out where the user is, and then use our best-guess to pre-select that item in the list? A quick proof-of-concept shows that there’s no reason not to.

The What and How of Geolocation

I’m sure ...

Read More

Using PHP’s auto_prepend_file and auto_append_file

The PHP logo.

The PHP logo. (Photo credit: Wikipedia)

Do you find yourself writing the same code at the beginning or end of each PHP file? Are you always starting and closing sessions or database connections? Good developers are always looking for ways to do less work and achieve the same effect, so it seems like there has to be an easier way to take care of these repetitive tasks.

Read More

How to Show Empty Search Results on WordPress

WordPress Logo

WordPress Logo (Photo credit: Phil Oakley)

When one of your users submits an empty search (that is, they click submit without entering anything in the text field), the default behavior for WordPress is to redirect to the home page, and no indication is given that there was a problem with the search. Unfortunately, this is not a user-friendly thing to do. How can we fix this?

Read More

Meta Keywords Blacklist for Search Engines

A client recently called us in a panic. Search engines were associating her website with terms to which she was morally opposed. Although there was nothing we could do about the situation, the call got me thinking about keyword blacklisting, and whether or not that would be a good idea.Read More

Dynamic Image Color Using CSS and PNG Transparency

While changing the color of every icon in the CMS at work for a custom rebranding, I thought, "there has to be a better way!" As it turns out, there is.Read More