The default howdy greeting

The default howdy greeting

I like the WordPress ‘howdy’ greeting. It’s friendly and it usually makes me smile when I login to the admin dashboard. But for some clients, something a bit more elegant is in order.

Changing the text of the greeting is easy if you’re willing to get into the theme files. All you need to do is open up functions.php in your theme’s folder and add this code snippet:

Replace ‘Hello,’ with the message of your choice.

Replace the WordPress ‘howdy’ with a timely message that’s more personalized for you.

Or if you want something a little more fancy, we can set it to include a message appropriate to the time of day. To do that put this in functions.php:

New modified WordPress greeting

New modified WordPress greeting

For this one, you’ll need to replace the date_default_timezone_set with your own timezone (assuming you’re the admin). You can find a list of PHP-style timezone formats here. Then you may want to change the hours and the contents of $msg to fit your needs or language.

One issue with timezones – there’s no way to detect them automatically with an HTTP header and other methods like geolocation can be problematic. If you have a number of admins in different regions, you can try using this script to detect the timezone and modify the code above to include that so that the timezone will change for admins as they login, but that’s a bit beyond this simple tutorial.

Recently I developed a WordPress site that uses a custom post type for Events. This is a typical event page – note the More Info section in the left sidebar.

The client needed to be able to insert a list of links under More Info, and the number of links will change for every event. I needed a way to make this super-simple for the client, so in the Events custom post editor, the links are entered one per line like so:

Then, I needed to convert that line break-delimited list into an unordered list for formatting… I had no idea how to do that but after some hunting around I found this post that completely answered my questions.

Then in my single-events.php template, I have this section including the wonderful code snippet from wordpressismypuppet that converts the entries into a standard unordered list:

So now the result is a ul under ‘More Info.’ formatted to match the other sidebar widgets. The client has a bare minimum of HTML to contend with and has control over what appears in the list – everyone’s happy!

I store my snippets in jCodeCollector but it’s probably a good idea not to rely on that completely, so I’ll start posting my snippets here.

Here are a few other resources for WordPress snippets; I’ve used each of these from time to time (but as a Theme Hybrid user, I get a lot of info from the Hybrid forums too).

Maybe I should also start saving them in Sublime Text 2, since I’ve migrated to that over the last couple of months… here’s a tutorial on managing snippets in Sublime Text.