Software Engineering in WordPress, PHP, and Backend Development

Tag: WordPress (Page 181 of 219)

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

WordPress and MVC (Gloves Aren’t Made for Feet)

One of the topics that periodically crops up in discussions as it relates to WordPress is the idea of WordPress and MVC.

That is, developers wants to take an MVC approach to building WordPress applications. And I get it – I love MVC. It’s why I used to work with Rails, it’s why I was really excited when Microsoft released .NET MVC years ago (when I was working in .NET).

But the thing is that MVC is not the silver bullet of web development that we try to make it out to be. Yes, it’s an awesome design pattern, and I personally think that it fits the web application model like a glove, but not every framework or platform implements that design pattern.

Case in point: WordPress is not MVC.

And that’s okay. I think we need to leave the desire of trying to shoehorn it into our projects aside especially when the pattern WordPress provides is not only sufficient, but works well when leveraged correctly.

Continue reading

Understanding The WordPress defaults Array

Earlier this week, I received an email from someone who was asking about the Settings API. Specifically, he was curious as to how the WordPress defaults array works.

For those of who may have worked with theme development, plugin development, or the Settings API in general, then you may be familiar with functions that look like this:

/**
 * Provides a default value for the theme layout setting.
 *
 * @since    1.0.0
 */
function get_theme_default_layout_options() {

	$defaults = array(
	    'layout'                         => 'right_sidebar_layout',
	    'display_featured_images'        => 'always'
	);

	return apply_filters ( 'theme_default_layout_options', $defaults );

}

But if you’re not familiar with the Settings API or with how to `apply_filters` call works, then this particular function can be confusing especially when it comes to understanding the serialization lifecycle of saving options to the database.

Continue reading

Comments on this post are closed. Please leave them on the original post.

Yesterday, I was humbled to have been featured being featured on ManageWP’s most recent article.

Directly from the the post:

I recently published a post on WPExplorer rounding up the names of ten personalities in WordPress that you should be following. Of course, those were not the only ten people that you should know about – there are many, many more awesome people in our community and no list can ever be complete.

Here I showcase, in no particular order, 25 WordPress thought leaders that I think you should follow – people who offer things of value to the community, be it awesome plugins, original articles, contributions to the core, etc.

Continue reading

My WordPress Site Migration Process

Yesterday evening, I had to take some time to migrate my site to a new server because I had outgrown the service on which I started.

While doing so, I realized I’ve never bothered to share my WordPress site migration process.

Honestly, there’s nothing particularly unique about it. Furthermore, when it comes to deploying things to staging, I’ll often use tools that interface with my GitHub account to push out the differentials.

WordPress SIte Migration

Migrations. Not quite what we had in mind.

But when it comes to move a single site installation from one server to another, I typically follow the same process.

Continue reading

WordPress Directories: inc and lib

In the previous post, I spoke briefly about WordPress directories. Specifically, I talked about placing files in an `inc` directory whenever building a theme. This lead to a comment by Richard that I thought was worth covering here:

In the theme folder, sometimes I see people use “lib” to include theme assets and other times I see them use “inc”, as you’ve done here. Is there a reason for one vs the other?

I gave a short response in the comments, but thought that this warranted a longer form explanation to share my perspective, and to hear what you guys have to say, as well.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑