DiggingIntoWordPress

by Chris Coyier & Jeff Starr

Monthly archives: October 2010

Dynamic Archives

Posted by on

Have you ever seen WordPress archives where you select something (usually a month/year) from a dropdown and it takes you to a page where you can view that? It’s fairly common. WordPress almost has built in functionality for it, since you can specifically tell the wp_get_archives() function that you want the values to be returned as <option></option>s. We can kick it up a notch though, and make the results show dynamically on the same page as the dropdowns through some Ajaxy JavaScript. We’ll even allow for multiple dropdowns (include the category as well) and make sure it’s flexible for your own alterations.

Splitting Up Custom Field Values

I’ve worked on sites in the past where I needed to get two values out of a custom field. For example, I was creating an eCommerce site where some products had options. The options were in a dropdown menu. Each option in the dropdown had a value for what you actually see, and then another value for how that option effected the price. When entering a custom field, I often did it like this:

Change Your Database Prefix to Improve Security

Posted by on

One of the awesome things about WordPress is that it’s a dynamic publishing system that uses a database to store your site’s information: posts, options, plugin and theme settings – all of this data is stored in your site’s database. It’s like the brain of your WordPress installation. Unfortunately the WordPress database is also a prime target in many website attacks. Spammers and other bad guys target various database tables with automated scripts, SQL injection, and other malicious code. Needless to say it’s critical to protect your database and keep recent backups. One of the smartest ways to protect your site’s database is to change the default table prefix to something obscure and difficult to guess. Sort of like a password.

Customize Your WordPress Dashboard

Posted by on

There are many ways to customize the WordPress Dashboard. Over the years, the Dashboard has evolved into a highly flexible information portal, enabling an overall, big-picture view of the main components of your site, while also providing granular data on everything from recent comments and plugin updates to incoming links and WordPress news. And that’s just the default functionality, there are also a ton of dashboard widgets and plugins available in the WordPress Plugin Directory that you can use to transform your Dashboard into just about anything, or even disable it completely.

Using Google Custom Search in WordPress

Posted by on

Once a WordPress powered site starts getting quite a bit of content, the default built-in search becomes fairly useless. It just isn’t very smart. If you wrote a comprehensive article about He-Man, but since have written five other articles that just mentioned He-Man in passing, a search for “He-Man” will turn up your comprehensive article sixth. There have been various tweaks and plugins and whatnot to try and make this better. But why not leverage the best search engine ever written instead?

Code is poetry