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.

Just recently I did some WordPress development work for a graphic design company. I thought their portfolio section was quite nice and used a few custom NextGen Gallery templates to pull it off. Here’s how I did it (mostly so I can do it again easily, but I hope this might help someone else too!).

Here’s a screenshot of the finished album:

NGG Custom Album

And here’s one of the galleries:

NGG Custom Gallery

(This post assumes you’ll need both Albums and Galleries, if that’s not the case, skip ahead as needed.)

After setting up each of the galleries and the album in NGG with some sample photos, I made two custom templates based off the existing NGG ones: album-clientname.php from album-extend.php, and gallery-clientname.php from gallery-caption.php. To make these, open the NGG plugin and you’ll find the original templates in the /view folder. Copy them and paste them into a new /nggallery  folder in your theme, then change the names as needed. Don’t forget to then go to the album and gallery pages in your site and change the shortcode to match the new template names:

[ album id=1 template=clientname] and [ nggallery id=1 template=clientname]

You’ll remove that extra space between the opening bracket and the first word in your own shortcode.

Here is the code for album-clientname.php:

And the code for gallery-clientname.php:

I didn’t change them too much; in the gallery template I removed some unneeded code and added a container around the alttext (which I’m using for the title on top of the thumbnail). In the album template, I removed the photo number and moved the album title, again adding a container to make it easier to style with CSS.

Here are the styles for the album – pretty simple:

Here’s the styling for the galleries:

For the gallery, I also needed to use a modified page-title on those pages that would show over the header image:

I made a new page template called page-galleries.php to use for the gallery pages so I’d have a body style I could hook into.

All in all this took about an hour to do, start to finish. I think it’s a nice-looking portfolio and I hope you find this useful!