Software Engineering in WordPress, PHP, and Backend Development

Category: Notes (Page 39 of 49)

Notes on programming-related problems that I’ve encountered while working on various projects.

Redirect Non-Administrators After Login in WordPress

For more technical users or to skip the the background explanation, skip directly to the code.

When it comes to building themes or plugins in WordPress, you rarely want administrators, editors, subscribers, and so on to anything other than the dashboard just after they’ve logged in.

After all, these authors are usually loggin in to write posts, edit their information, or generally manage their content.

But if you’re building a more advanced theme or an application, then allowing users to view the dashboard may be outside the scope of what you’re looking to allow.

As such, here’s an easy to redirect non-admin users to another page after logging into WordPress. Note that this post was updated on December 13, 2012 thanks to the recommendations in Simon’s comment.

Continue reading

Show The Date on Every Post in WordPress

When it comes to displaying the date on blog posts, many WordPress themes – not all, but many – opt to display the date on the most recent post of the day, and then simply display the title and the content for the rest of the posts throughout the day.

This results in the content feed looking something like this:

But not everyone likes that. Luckily, there is an easy fix for this.

Continue reading

Happy Thanksgiving!

Happy Thanksgiving 2012

Happy Thanksgiving!

If you’re here in the United States, then you’re likely celebrating Thanksgiving. I’m spending time resting, eating some awesome food, visiting family, and generally enjoying the time off.

For those of you who aren’t in the US, hopefully you’re having a stellar day, as well. Continue reading

How To Get Post Content By Title

I've updated some of the content in this post for more clarity thanks to Stephen's comment

When it comes to retrieving content outside of The Loop or retrieving content based on certain criteria, it’s usually a matter of setting up a custom query using WP_Query.

But sometimes, setting up a full custom query, executing the loop, then resetting the post data isn’t required.

Case in point: I was recently working on a project in which the client wanted a modal dialog to appear with the title and the text from a specific page. Easy enough: use get_page_by_title.

But there’s one minor gotcha that I’ve seen more than a few times when using this method. Here’s how to get post content by title and avoid the pitfalls of doing so.

Continue reading

My WordPress Development Toolbox

I update this post as my workflow changes. This post was last updated on January 10, 2014.

Periodically, I’ll get emails or comments asking about the various tools that I use in my workflow. You’ll rarely hear me saying that I think any given developer should be using any given piece of software.

Instead, I think that out of all the tools that we have from which to choose, we’re naturally going to like some rather than others – there’s not always going to be a general consensus. Because of that, I’m more likely to share what I like rather than what I suggest.

Since blogging is just as much for the readers as it is for the author, I thought I’d take some time to share what tools I use on a daily basis. Consider this a comprehensive list of tools in a WordPress Developer Toolbox.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑