Software Engineering in WordPress, PHP, and Backend Development

Category: Articles (Page 249 of 258)

Personal opinions and how-to’s that I’ve written both here and as contributions to other blogs.

Five Suggestions For Writing Better JavaScript in WordPress

This is the final post in the series JavaScript in WordPress. Be sure to read the first article, too!

In the first post in this series, I briefly mentioned that there is a problem with writing JavaScript in WordPress. In boils down to the fact that people are writing JavaScript who don’t truly know jQuery (let alone JavaScript), and that there are lack of standards to follow.

And though I’m not interested in defining the coding standards for JavaScript in WordPress – at least not here – I am interested in sharing four things that I’ve found to be successful in writing maintainable jQuery in WordPress for both individual and team-based projects.

Note, of course, that these are geared towards jQuery. After all, that is WordPress’ JavaScript library of choice.

Continue reading

The Problem of No Coding Standards For JavaScript in WordPress

This is the first post in the series JavaScript in WordPress. Be sure to read the final article, too!

JavaScript in WordPress

One of the challenges of building projects on top of WordPress is that there are well-defined coding standards specifically for PHP-based components. There are even some guidelines for HTML, and the CSS guide is under construction, but there appears to be very little in way of coding standards for JavaScript in WordPress.

I’m certainly not going to be defining those standards here – that belongs in the Core Contributor Handbook, right? – but I am doing to be sharing my thoughts on JavaScript in WordPress and some of the things that I do in order to make sure that my projects and that my team’s projects are maintainable over time.

Continue reading

Writing WordPress Code – Clean, But Not Clever

I think of one the biggest challenges that programmers face as we become more comfortable and well-versed in our programming language(s) of choice, is that we become intimately aware of some of the more clever things we can do with the code.

For example, one feature of dynamic programming languages is that they offer anonymous functions. They’re really powerful and you can do some really cool stuff with them, especially in JavaScript; however, this always introduces a tension:

Are we writing code to be clever or are we writing code for others to understand?

Since I spend the majority of my time working with and writing about WordPress, I thought I’d share my thoughts on writing WordPress code.

Continue reading

Why I’m Against Placing Custom Hooks in WordPress Themes

One of the things that I my team and I are often asked is if we’re ever going to place hooks in our core theme files for Standard. The short answer is “no,” but there’s actually a few reasons why I’m personally against placing custom hooks in WordPress themes.

Although this is stemming largely from building and managing a commercial theme, the discussion isn’t limited to that particular scenario. Rather, this is something that I’ve actually discussed with a number of other WordPress users and developers.

Overall, I’m generally against placing custom hooks in WordPress theme files, so I thought I’d share my reasons why I’m not a fan of doing this.

Continue reading

How I Organize My Files When Developing WordPress Themes

I recently shared how I organize my files when developing WordPress plugins, but since I also work with themes and have recently been building two applications using WordPress, I thought I’d also share my thoughts on organizing WordPress theme files.

For what it’s worth, I think that some developers – especially beginners – often try to make the plugin model fit the theme model or vice versa, and although both types of projects are aimed specifically at WordPress, they require different approaches.

Simply put, theme file organization differs from plugin file organization. With that said, here’s how I organize my files when developing WordPress themes.

Continue reading

« Older posts Newer posts »

© 2025 Tom McFarlin

Theme by Anders NorenUp ↑