Software Engineering in WordPress, PHP, and Backend Development

Author: Tom (Page 246 of 428)

Programmatically Deactivate WordPress Widgets

If you’re in the business of building themes for fun, for clients, or for purchase within a marketplace or your own store, then there’s a chance that there’s some type of functionality that’s unique to your theme that should be activated whenever the theme is activated.

In my experience, this is something that’s typically unique to niché WordPress themes because they tend to have specific features, customizations, and so on that are relevant to their theme.

Case in point: Let’s say that you’re working on a niché theme that has a number of widgetized areas, but also has very specific widgets for said areas. That is, upon theme activation, you want to make sure that each widgetized area is clear so not to bust up the layout.

In other words, you need to programmatically deactivate WordPress widgets whenever the theme is activated so that the layout of the theme looks as it should when the user activates it.

Continue reading

“When Should I Use Ajax?” and Other Mysteries of the Web

A few months ago, I published a post that covered how to achieve single page tabbed navigation in WordPress. In the post, I mentioned the following:

In some cases, it may be best to load pages via Ajax, in some cases, it’s better to load things up all in the first page load.

Generally speaking, I stand by this statement. I know Ajax is fun and I know that it’s gotten incredibly easy to implement, but there are times where it makes sense to load all information with the page and times when said loading should be done asynchronously.

In the comments, someone asked:

I am also very interested and awaiting post regarding your take on when to use ajax and when to load it all.

Though this could have been answered in the comments, it seems as if this is an ongoing discussion among those who build things for the web, so I thought I’d take the time to answer it in the form of a post. If nothing else, perhaps it will spark you to share some of your opinions on it, as well.

Continue reading

One Way To Add Multiple Meta Boxes

One of the things that I like about open source the most is having discussions not only about how a person goes about doing something, but why they’ve chosen a particular route over an alternative.

Yes, reading books, articles, and other material from prolific, well-known, and respected programmers matters – I’m definitely not saying that we should throw that out – but there’s a lot that can be learned from peers who are sitting a couple of tweets, emails, or gists away from you.

Though I generally enjoy seeing how other people have approached their work and understanding the rationale behind it, I’m also pretty open about how I approach certain problems if for no other reason that the garner feedback from those of you who take the time to update gists, add comments, and so on.

Continue reading

Maintainable WordPress Meta Boxes

The comments on this post are closed. Please leave your feedback on each of the respective articles.

When it comes to enhancing the functionality of the CMS, WordPress meta boxes are one of the most flexible features that we can introduce to the post editor screen.

In short, they’re a way that we can open additional fields to one, some, or all of the existing post types as well as custom post types. They also make it possible to introduce a number of different type of elements – be it input fields, textareas, checkboxes, etc. – so that users can easily view, add, and/or modify data associated with a given post.

When it comes to writing meta boxes, especially those that are more elaborate than others, it can become a bit of chore to maintain the code over time. But it doesn’t have to be that way.

Continue reading

Become a Better Programmer. Just Like You.

Hang around any community long enough and you are going to see the good parts, the bad parts, and the weird parts . Similarly, I think that anyone who has been involved in any type of community for a significant amount of time will have plenty to complain about.

I’m not just talking about online communities either – this is just as applicable online as it is offline.

But, if you’re reading this, then you’re reading this online and odds are you’re active on Twitter or Facebook or some other form of social media where we all use the services as our own platform for sharing our opinions with the public where others can read, respond well, respond negatively, or ignore.

Whatever the case, I think that we’ve gotten far too comfortable sharing our criticisms in 140 characters or less without showing enough empathy or understanding or education for our peers and it’s to our own detriment that this is happening.
Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑