Tom McFarlin
Tom is a self-employed developer who loves writing, building, and sharing WordPress-based projects. He runs Pressware where he provides WordPress goods and services. You can follow him on Twitter.
  • Code
    Practical Tips for Improving Your CodePractical tips for improving your code
    On this site, we spend a lot of time sharing information and discussing how to accomplish certain things with WordPress. After all, the purpose of the site is to provide tutorials - that is, we attempt to give practical advice on how to build certain things using the platform. But development isn't strictly about writing code and building things. It's also about writing quality, maintainable code, refactoring and improving the state of our projects, and generally trying to leave a codebase in a better state than it was when we found it (or when we began creating it). So rather than focus on how to build something or review any particular code, let's review a few practical tips for writing quality WordPress code.Read More…
  • Code
    A Case for Code Comments: The Client-SideA case for code comments   the client side
    In this two-part series, we're taking a look at building a case for code comments. In the first article, we covered the server-side by taking a look at PHP. Specifically, we reviewed PHPDoc conventions and how to use them to document templates, functions, and lines and blocks. In this article, we're going to take a look at client-side languages. Specifically, we're going to look at HTML, CSS, and JavaScript.Read More…
  • Code
    A Case for Code Comments: The Server-SideA case for code comments   the server side
    When it comes to writing code, regardless of the language or platform that's being used, we developers tend to be divided on how much or how little we should comment our code. On one hand, there are some who believe that code should be self-documenting. That is, it should be written clear enough such that it doesn't need comments. On the other hand, some believe that everything should be commented. That is, there should be comments for every class, every function, every block, and every line. Then, of course, there are those who fall in the middle. In fact, some developers only comment areas of their code that may be confusing rather than picking the all-or-nothing approach outlined above.Read More…
  • Code
    Two Ways to Develop WordPress Plugins: Object-Oriented ProgrammingTwo ways to develop wordpress plugins   part 1   object oriented progamming
    When it comes to writing WordPress plugins, there are generally two ways to go about doing so: Object-Oriented Programming and Functional Programming (with Widgets being the exception - we'll cover that later in the article). Though you generally have people vouching for one style of programming over the other, each presents its own set of advantages and disadvantages. In this two-part series, Stephen Harris and I are going to break down the two ways that you can go about writing WordPress plugins. Specifically, I'm going to talk about object-oriented programming, and he'll be covering functional programming.Read More…
  • Code
    The Beginner's Guide to WordPress Actions and FiltersThe beginners guide to wordpress actions and filters
    When it comes to professional WordPress development, it's imperative that developers understand both actions and filters - that is, it's important to understand WordPress hooks. Simply put, hooks are what give us the ability to customize, extend, and enhance WordPress through an API in our themes, plugins, and other custom development efforts. The problem is that these two features of WordPress - arguably the most important aspects of developing for the platform - are either widely misunderstood or completely ignored. In this post, we're going to take a look at the WordPress page life cycle, understand how hooks work, and review the differences in actions and filters so that we may not only become better theme and/or plugin developers, but also have a deeper understanding of how WordPress works.Read More…
  • Code
    A Primer on Ajax in the WordPress Frontend: Actually Doing ItThumb 02
    In this series, we're discussing how to implement Ajax in the WordPress frontend. In the first post in the series, we reviewed how Ajax works at a high-level, reviewed how to introduce Ajax into the Dashboard of WordPress, and reviewed the two hooks available for incorporating Ajax into WordPress. At this point, it's time to actually build something that will demonstrate how we can use Ajax in the WordPress frontend. To do this, we'll be writing our own plugin making sure that we're following WordPress best practices along the way.Read More…
  • Code
    A Primer on Ajax in the WordPress Frontend: Understanding the ProcessThumb 01
    A few articles ago, I gave a primer on Ajax in the WordPress Dashboard, but the comments lead to a discussion for exactly how to do this on the WordPress frontend (and how to do it the right way).Read More…
  • Code
    Professional WordPress Development: Tools03 tools preview
    In this series, we've been reviewing topics for Professional WordPress Development aimed at those who are looking to improve their professional WordPress development skills. At this point, we've covered strategies and environmental practices, but we've yet to examine some of the tools that are more common in WordPress development. In this article, we'll be taking a survey of the various tools, utilities, and plugins that contribute to building and maintaining successful projects.Read More…
  • Code
    Professional WordPress Development: Environments02 environments preview
    In this series, we're taking a look at the various practices that are used in professional WordPress development. In the previous article, we reviewed a set of strategies and reference material that are useful when building themes, plugins, and WordPress-based applications. In this article, we'll take a look at version control and environmental configurations that make it easy to develop, test, and deploy our work to minimize the amount of errors that find their way into final versions of our work.Read More…
  • Code
    Professional WordPress Development: Strategies01 strategies preview
    Working in the WordPress community is both a blessing and a curse. Because of its open source nature, we have a fantastic platform on which to build websites, themes, plugins, and even applications. It's got a smart community around it, rich documentation, and standards that aim to provide the way to write code for it and the way to build tools around it. At the same time, the open source nature of WordPress as well as the languages with which it's built allow anyone to ship their work regardless of if it is up to any kind of standard or uses any kind of best practice. For many users, they're none-the-wiser about what's going on under the hood. If the product works, they're happy. As people who are serious about their craft, we absolutely cannot settle for "just getting it to work." We have to care about what's under the hood. If you're a serious WordPress developer, then you likely already have a method to how you work, but if you're just getting started or are looking to define yourself as a professional WordPress developer, then there are strategies, environments, and tools that you can utilize that can help. In this three article series, we're going to look at exactly what those are and how they apply in our project work. First, we'll start with strategies.Read More…
  • Code
    How to Include and Require Files and Templates in WordPressPreview
    When it comes to PHP, a lot of developers love the language, a lot of the developers hate the language, and a lot of developers generally just use it to get their work done. For what it's worth, I'm of the latter camp. I think PHP is fine. Like anything, it's not without it's problems, but I enjoy working with it well enough and see it as a way to get work done versus some pie-in-the-sky language for some time of utopia of development. The thing is, one of the things that developer's love about PHP - its features and flexibilities - are the very things that often trip us up. The list is long, but in the WordPress world, one of the most common points of confusion is the proper way to include external files. PHP offers four(!) ways to do this and WordPress even offers its own variation thereof. In this article, we'll survey the four ways that PHP offers to include files, guidelines for when to use each, and we'll review WordPress' features for including files.Read More…
  • Code
    A Primer on Ajax in the WordPress Dashboard - Requesting and RespondingThumb 3
    In this two part series, we're taking a look at how to properly introduce Ajax-specific functionality into the WordPress Dashboard. In the first article in the series, we began working on a plugin that displays a notification as soon as it's activated ... but that's it. In this article, we'll add Ajax-enabled functionality that will allow users to dismiss the message and we'll finish up with a working version of the plugin. Specifically, we're going to cover all of the things necessary on both the server-side and the client-side that are necessary to process an Ajax request and respond appropriately. Finally, we'll review a checklist of items that all Ajax-based WordPress functionality should have to make sure that you properly employ the API in future projects.Read More…