Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 203 of 219)

Articles, tips, and resources for WordPress-based development.

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

On Offering WordPress Support and Documentation

WordPess Support

Ah, the stock photo of Tech Support for the entire Internet!

One of the challenges of providing solutions built on top of WordPress is handling expectations of support and documentation. I’m not talking about running a support forum or writing elaborate API documentation.

Instead, I’m talking about providing instructions for how users can manage their site, application, or plugin once you’ve completed work on the project.

Over the past couple of years, there have been a few things that I’ve tried. I’m definitely curious to hear you guys’ thoughts on what you’ve done and what you’ve found to be successful, but first, here’s how I’ve historically handled WordPress support after a project handoff.

Continue reading

My Preferred WordPress Hosting

Preferred WordPress Hosting

I’m a big fan of Site5

Earlier this week, I had a couple of people shoot me an email asking who I preferred in a WordPress host. The truth is, when it comes to preferred WordPress hosting, both developers and designers have their vendors of choice.

I’m no different.

As you can tell from the screenshot above, I’m personally a big fan of Site5. This is not a sponsored post – simply a reason as to why I prefer these guys.

Continue reading

Quick Tip: Including jQuery in WordPress The Right Way

Much has been said on the subject of properly registering and enqueueing scripts in WordPress, so I hate to write yet another “including jQuery in WordPress the right way” post, so I’ll attempt to cover it from a different angle.

Because jQuery ships with WordPress, it’s really just a simple matter of making sure you call:

wp_enqueue_script( 'jquery' );

In your functions.php file.

But that’s really only half of it. After that, you have a matter of actually setting up your JavaScript source.

Continue reading

Writing Clean, Maintainable Custom WordPress Queries

Recently, I was having a conversation with a fellow developer via email about maintaining a separation of concerns in custom WordPress queries and WordPress templates.

The gist of the conversation boiled down to this:

Is it a good idea to keep custom queries in the template files?

A couple of years ago, I would’ve said yes but as I’ve begun to work on more complex projects, I’ve changed my mind: I’m actually a fan of keeping custom queries in functions.php.

I think that this keeps code more maintainable, cleaner, and easier to read, though I’m not sure if this is the most common practice.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑