Turn That Snippet Into A Plugin

This post is sort of a recap of a talk I gave a couple years ago.

Whenever you get a WordPress code snippet, where do you put it? It’s not uncommon all those bits of code to end up cluttering up the functions.php file of your theme, whether out of habit or suggested by tutorials.

But wouldn’t it be better if all those non-theme snippets were plugins instead? Yes!

As plugins, you can switch/upgrade themes without losing that functionality and toggle the funtionality without editing the theme.

And great news! It’s really easy to turn a snippet into a plugin.
Continue reading Turn That Snippet Into A Plugin

Fetch the User-Agent String and Save as User Meta

Some times a client will complain that their site doesn’t look right or something equally as vague. Inevitable we ask “What browser are you using?” but getting the answer can be tricky. So, let’s just automatically get their user-agent and save it where we can access it.

Granted, this isn’t perfect. The client could have just logged in from someone else’s computer, and it is possible to fake the user-agent… but I’m counting on this being rare.

Continue reading Fetch the User-Agent String and Save as User Meta

Swap Color Schemes When in the Network Admin

In WordPress 3.1, the network-wide options being moved to their own area in WordPress to make it easier on network administrators.

To take a just a bit further, I put together this script that will switch color schemes when you’re in the Network Admin.

Continue reading Swap Color Schemes When in the Network Admin

Confirm Email Address

If you’re running a WordPress network, and depending on how you’re using it, you may need to get users to confirm or update their email address.

In my situation, I build a lot of sites for clients, and during development I use an email address of my own so they don’t get bombarded with emails they don’t need. But I don’t always change it back when I’m done, or maybe there’s a typo. Or maybe it’s the client that has changed their email address.

Whatever the cause, sometimes these things just need to be double-checked and confirmed. So here’s a small plugin that can be dropped in your mu-plugins folder:

Continue reading Confirm Email Address

Change “Howdy” to Something Else

I’ve got nothing against the “Howdy” greeting in WordPress, but in case you do, this little snippet might just help you out.

It’s currently set to change “Howdy” to “Yo.” Just drop this in your functions.php file. I’ll turn it into a spiffy plugin later… Continue reading Change “Howdy” to Something Else

Adding More Classes to wp_list_pages()

Download

If you’re trying to style nested items in wp_list_pages() the task can be daunting. You’ll apply a style to an <li> then have to unapply those styles for the nested <li>s, and if you’re dropdowns get any deeper, you CSS can become overwhelming. It’s a little better if you don’t care about IE, because then you can use those fancy CSS selectors like ul > li, or ul li > li to target certain depths. But if you’re stuck fighting with IE, maybe this will help.

Continue reading Adding More Classes to wp_list_pages()