Building Utility Plugins for WordPress with Tom McFarlin

Sponsored by:

Tom is a man of many hats! He’s a WordPress user, avid blogger, developer, editor for Envato, and much more. He also takes the approach that he’ll scratch his own itch if he needs to. In this episode, we talk about how he tackles problems, why and how he built the plugin Page Template Dashboard, and his development tools.

Show Notes

Check out my new WordPress Theme Development course & get 20% : How to Build WordPress Themes

Joe Casabona: This episode is brought to you by our great sponsors. BoldGrid works as a suite of plugins designed to help you create WordPress websites faster and easier than ever. BoldGrid will improve your workflow by providing direct access to free themes, page templates, photography, design elements, forms, galleries, and much more right from your dashboard. And the BoldGrid page builder allows you to easily drag and drop and edit the content as you see fit all with that having to use shortcodes. Head over to builtpodcast.net/boldgrid. That’s  builtpodcast.net/boldgrid.

If you like building things on the Internet, especially e-commerce things, check out the open jobs with Prospress. They’re a small but friendly bunch that loves building software for entrepreneurs. They’re the company behind WooCommerce subscriptions, a plugin with thousands of users. But that’s just the beginning. Prospress has some new products in the works and they’re looking for talented folks to help them. If you dream of working in your pajamas, sipping macchiatos at your favorite cafe, or while soaking up the sun in Costa Rica, you can make it happen. Prospress is a distributed company with employees all over the world.  They offer some neat benefits like stock options, hardware allowance, and professional development. But the best benefit is the autonomy to do your best work however you work best. If this sounds like your kind of gig, check out their open positions at builtpodcast.net/prospress. That’s builtpodcast.net/prospress. And now, on with the show.

Hey, everybody. Welcome to How I Built It, the podcast that asks “How did you build that?” Today, I am honored to have my good friend and guest Tom Mcfarlin. Tom, how are you?

Tom Mcfarlin: I am doing well Joe. How are you, man?

Joe Casabona: I am fantastic. It’s warmer than the weather in January, warmer weather than usual in January as we record this so I’m very happy about that. So today we’re going to talk about one of your plugins, right, Page Template Dashboard?

Tom Mcfarlin: Yeah, it’s terribly named but I’m excited to talk. I mean I’m excited to be on the show. I’m excited to talk about it but it’s definitely, this is a terribly named plugin that will talk a little bit more of it later in the show that ended up turning out to be something people wanted more than I realized.

Joe Casabona: Nice. Well name aside, I’m excited to talk about it too. Now, we just recently met in real life for the first time but we met through Envato, I think, right? Like we were both writing tutorials for them at some point?

Tom Mcfarlin: I think that is right. I know and I don’t know. I’ve been, I’ve written tutorials for them on and off since 2011 and now I help edit code and game development posts, so. And I still write when I have the chance but last year I did a lot of writing. This year I’m going to rain it back in a little bit. But yeah, I think that’s where our paths crossed the first time. They’re Twitter or both at the same time.

Joe Casabona: Yeah, yeah. Yeah, so why don’t you tell the listeners a little bit about who you are and then kind of how you came up with the idea for the Page Template Dashboard?

Tom Mcfarlin: OK sure. So as Joe mentioned, my name is Tom McFarland. I am on Twitter @tommcfarlin and you can find my blog at tommcfarlin.com or Tommcfarlin.blog, it’s actually already in the same place but, you know, is there. A blog pretty much every single day about some aspect of professional WordPress development. Now, what is that entail because that can cast a pretty wide net? The short answer is that I try to take a computer science-based approach or a software engineering-based approach to tackling problems in WordPress. Now when I say problems in WordPress I don’t mean like “Oh, WordPress has a problem or a bug and we’re gonna apply all of this enterprise-level methodology, and here’s how we’re gonna fix”  I don’t mean that at all. I tend to treat WordPress actually as a black box and I build solutions for other people for a living and for fun or for fun as profit is all the cool kids say. And then I  see, I treat WordPress as a black box and then I build solutions for others on top of it. And then sometimes I will write about my thoughts, my perspectives or how I tackled the problem, why I tackled it a certain way, or how I handled things in a certain way. 

My background is in computer science before even working with WordPress, I was working professionally with ‘.net’ building web applications for a large Internet company here in Atlanta. And then when I went self-employed I was doing some web development or web application development really using Ruby on Rails and a little bit of WordPress. And then over the course is really a year, maybe a year and a half WordPress demand began to outpace work for rails so I shut down the rails or the workouts were on rails and focused solely on WordPress, rebranded the company as pressware. And that is what I do now in order to make a living. So I like to write about it, I like to talk and write words, I like to write codes, and I like to do podcasts.

Joe Casabona: Nice, very nice. And you do have like several different blogs that you write on, right?

Tom Mcfarlin: Yes, and to be clear, I didn’t set out and say, you know, I’m gonna write on two or three blogs. When I started blogging, I didn’t start daily. I started thinking it was like “Oh no”. It was once a week, then it was three times a week, then it was five times a week and it’s just been that way ever since. And then people began to ask me about what apps do you like for this, and how do you manage your time, and this that are the other about self-employment, and how do you organize this kind of stuff? And I thought you know, I’m running a lot of emails about this same stuff. Maybe I’ll just turn some of this stuff into a blog. So I wrote, I started off spun up another blog. I write on it about once or twice a week and it covers these kinds of topics and it’s at ‘heyi’mtom.com’ because I am so creative when it comes to naming things as we’ve already established. And that’s where I write about that kind of stuff.

Joe Casabona: Nice, so that’s a great piece of advice for people who are looking to blog more, right? Take questions that people are asking you. And instead of writing up an email, maybe convert it to a blog post and go publish it.

Tom Mcfarlin: Yes. If you get, if you are getting the same email from a variety of different people or maybe the same kind of tweet or if you’re on Facebook and you’re getting the same kind of question that’s really maybe, you’ve found a niche that you’ve got something figured out that other people want to be able to figure out or want to be able to apply. And then you can use that as the foundation or the inspiration behind the blog post or blog an entire blog, yeah.

Joe Casabona: Awesome, very cool. So let’s turn our attention to the Page Template Dashboard. Why don’t you tell us a little bit about that and you know, what gave you the idea for it?

Tom Mcfarlin: OK. so Page Template Dashboard, if you look for it in the WordPress plugins repository you’ll find the subtitle being an easy way to, an easy way to see which templates your pages are using without having to view the page editor. And the whole idea behind it was at some point in time I was working on a very large WordPress project and this project had a ton of pages. And these pages, not only did they have a ton of pages there was a panoply of templates. And in order to see what template was being used I had to keep going into each page and editing it, and checking out the meta box be like which template is being used here so that I could go through and either improve, debug, or change modify. I don’t wanna break anything so basically, I was trying to just accumulate information. And yeah, there are definitely ways to do this outside of creating a plugin but once you’ve done that you think surely I’m not the only one with this problem. So I wrote this incredibly small plugin, and I think I stuck it on GitHub years ago and just as a place to store it. I didn’t plan on it gaining any traction, I didn’t plan on it and it still doesn’t really have that much traction. I mean, it’s got like 1000 active installs but I do get emails and questions for feature requests and things about it. So out of those people, someone’s using it and someone wants features so there’s that. But what it does is if you go into your admin area of WordPress and you click on all pages, you will see in the list view an entire, there will be an entirely new column and it will give you the name of the template it’s being used for a given page. And if a template isn’t being used then it just says default, so you know “Hey, this is using the default template that comes with the theme.”

Joe Casabona: Nice. So you built this out of a kind of a need for yourself. So was there any research that really went into it or did you just kinda code it up and put it out there?

Tom Mcfarlin: No, I did not do any research in terms of his or something already out there like this because the reason or the whole catalyst for this was I was really deep in the weeds on this. I was up against a deadline and I had really hacked together this hodgepodge set of functions and was using it to help return a collection of the templates that were being used for a given page. And it didn’t look good, there was no user interface, it was just dumping things out into a log file that I was looking at. And then I thought maybe somebody would want this in a prettier way. So then I formalized it into a plugin and I tried to use far more. I did not use just, had functions, hacky functions, and writing things out to a log file that actually uses proper conventions and hooks and filters and actions and things like that. And then it uses the WordPress API to generate the stuff that you see on the screen.

Joe Casabona: Nice, very nice. And what was kinda, I know that you, so you put it out on GitHub, you eventually decided to submit it to the WordPress repo, where you getting a lot of like requests to put it on the repo? Is that what…

Tom Mcfarlin: No, and to be honest I debated whether or not to even bother putting it on the repository. But what was happening was the activity that was going on with it on GitHub, I don’t remember ’cause I have another, there’s another plugin that’s also poorly named. That time GitHub was getting kind of a flurry of activity and I think around this time I needed Page Template Dashboard. I cloned the repository and I thought “Oh my gosh! this looks awful” And that is, and that’s because when I wrote it I was not where I am today. And if I looked at you know, give me two years or three, record this I’ll tell you I can’t believe I thought that was great. But the point is that I’ve got a much wider arsenal of tools and much stricter coding standards and things like that.

Now, so I introduced localization better coding standards, I did semi-object-oriented programming. Now I am a fan of that, I will not go down that rabbit hole because that is not the podcast for this. There are still ways in which it could be refactored but I want it once I notice there was some activity on it on GitHub. I thought let me just put this in the repository and see how it does. And so I put it in and I updated it about a month ago, and at the time of this recording like you said, it’s about mid-January. So at the time of the recording, it’s about 1000 active installs, it’s got six five-star ratings out of six. So if you’re listening to this and you use it please go read it because six out of 1000 is like, I mean come on. But anyway or but seriously it’s one of those things that I am in the process of building a small suite of tools called Blogging plugins that I’m going to talk about later this year on my blog or on a podcast or wherever someone asks me about it. And that’s not a hint here but that is just to say that this was kind of a let me see if you’re a Blogger let’s see if this is something that you would use ’cause I do have a few other plugins that I have had someone else adopt ’cause I’m trying to clear my plate of all the stuff I’m working on and make room for these Blogging plugins. And it looks like even something like Page Template Dashboard has a small amount of demand for hey like “I wanna get some…this is something that could be used in my set of tools” so that’s why it’s in the repository is basically the gauge demand.

Joe Casabona: Gotcha, very nice. And so maybe in lieu, well I guess first, will ask you know, I always like to ask if there’s, if you’re part of a mastermind group or if there’s people that you get advice from about business and direction. So maybe we can talk about how you know you’re kind of scratching your own itch with the Page Template Dashboard. But you’re building out this bigger tool, and do you have any thoughts for or ideas for building a business around that?

Tom Mcfarlin: Yes, and so there’s a couple of questions that you asked and I’ll give him some short answers, and then we’ll come back to this last one. First, I’m not part of a mastermind that’s not from an invitation, there was a lot of thought, there was a lot of discussions. I mean I ask, I probably like interrogated the person who invited me into theirs, they put up with me, let’s put it that way, put up with all my questions. And I ultimately decided that at this point in time it wasn’t right for me. But I do have a small group of people around me who I talk to regularly, I run ideas by or I’ll try to help them, it’s kind of all mutual. And then I do have, there or some people with respect to business that I will talk to. 

First off, my dad has my mom and dad, started their business when they were 40 and they’re in a completely different industry. But it’s funny how there are some principles in business that transcended industries. And then I have some other friends, some who are listening may also be familiar with guys like Chris Lema and Josh Ethan of Reaktiv studios with Andrew Norcross. Those are two guys who I talked to a good bet with respect to business. Sometimes it questions, sometimes it’s just as they, you know, shooting the breeze as they say and then there’s sometimes it’s like hey there’s a, you just kind of stumbled into something by accident. Now that is not something I would never just like throwing darts or that’s like throwing something against the wall and hoping it sticks, and I don’t recommend that as a strategy. That’s not a strategy, that’s just like “hey, I hope I find the luck” I do think it’s important to have people who are further down the road than you who can mentor you or who are willing to answer questions for you and give you advice. 

And I do have some other people in my life who are in the tech industry. They work in different segments but they are people who I have like a weekly or a monthly call with. And sometimes it’s to talk business, sometimes it’s actually talking about personal life which is something you know, like mentorship is not just relegated to a or doesn’t have to be relegated to a single or dedicated to a single silo. And the very last part of the question that you ask, can you repeat that, please?

Joe Casabona: Yeah, so you mentioned that the Page Template Dashboard is hopefully going to be part of this kind of bigger idea that you have. Are there any, have you thought about ways to kind of build a business around that? Or do you have a clear direction for that, I guess?

Tom Mcfarlin: So for blogging plugins in general, yes. I have a business plan, I have a mission, I have a vision, all of that stuff can be sprouted out and shared and plastered on the walls and all of that kind of stuff like when it comes to the step that people say you should have for a business. And you know, some people I’m not saying you gotta have like a nine-page business plan document. It could be like, it could be four bullets of here’s how the business is going to be structured. 

Yes, for Blogging plugins I absolutely have that, for this particular plugin, no. But you will find other plugins that I have like Easier Excerpts, Scheduled Post Shortcut Things, like that. Those are all part of what will eventually be Blogging plugins. Now I’m not gonna do like “Hey, they’re free right now and then you gotta pay later.” Some things are gonna be free, but there will be some things that will be premium and all of that will be discussed a little bit later because there are some things that are in development right now. And in case things change between now and when I release them, I don’t wanna say “Hey, this is what’s coming down, this is, you can expect this plugin.” And then that plugin never sees the light of day.

Joe Casabona: Right, right. Cool, very cool. ]Well very excited to see that when it comes out. So let’s get to the, you know, we’re a little over 15 minutes here and we gotta get the title question. Especially excited to ask you this because I love your blog, especially talking about the tools and things that you use for it. So how did you build a Page Template Dashboard? And this could be like coding methodology or it could be the tools that you used to actually build this plug-in.

Tom Mcfarlin: Sure, so the methodology, I prefer the object-oriented paradigm. Now if you were to look at the source code for this, you would say this is something like Sudo and that is because of the nature of the plugin like when it’s something that’s free and you are juggling a variety of other responsibilities you have to draw a line in the sand and say “This is as far as I can go with it.” So in terms of the paradigms, I did use object-oriented programming and everything kind of starts off for me. You know, after it starts off in someone’s head, I draw it out and I sketched out on a piece of paper and that doesn’t necessarily mean when I sketch the user interface, I also will sketch out the architecture for the class diagram for how different components of the plugin are going to work together and then I get to work. Now in terms of things, this has changed over time like I’ve begun, I began to use composer last year for dependency management. So I will use a PHP code sniffer to find problems in the code and I do use the WordPress coding standards. I know that there is some debate between on like should you use the WordPress coding standards or should you use the PHP standards. And that’s a fun conversation to have but not for right now. 

And in terms of other tools, there’s not a whole lot going on in terms of presentation. So like your client-side languages, they don’t have any of that but it is internationalized. And I know that now WordPress has just in time translation.  But before they had that I was using our, I was using Poedit or Poh-edit as some people refer to it. And that’s a fantastic piece of software that makes it really easy to create an internationalization file so other people can localize your plugin. 

so right now the suite of tools that I use is PHP code sniffer with the WordPress coding standards. I have grown to love the Visual Studio Code IDE, I used composer. And I guess really, I mean I use GIT for source control and I do like towers although out there are times where all will just default using the terminal. And when it comes to the WordPress plugin repository subversion is what they use. So that’s the source control I use whenever I’m submitting it there or update.

Joe Casabona: Gotcha. So that actually leads to a great follow-up question. So you need to use subversion for submitting a plugin to the WordPress repo. Could you talk about that process a little bit because it’s, if you’re coming from Git or not, no version control whatsoever, you know, it could seem a little bit concluded.

Tom Mcfarlin: Yes, so normally if you’re coming from Git using subversion, you’re probably gonna find people who have a love-hate relationship with it and I get it. But each of them is just different ways of managing source control and whatever works best for you and or your team, stick with that. But if you’ve never submitted anything to the WordPress plugin or repository, the idea of source control or version control can sound really intimidating. And when you have to learn these commands like when you go to the page if I remember correctly, it shows you these several commands that you have to enter in a terminal, and all the sudden you are, you’re like “I just learned to write enough PHP to make something happen in WordPress. now I gotta hop in a terminal and submit these things.” And there are these retina-ready assets, and there are these lower-res versions of the access, and then there’s a trunk folder and I don’t know if that’s an elephant trunk or the trunk of a car and there are tags and branches, and what does this have to do with trees? And you know, it just gets really convoluted really really quickly and I think that is sad because I think it can scare some people off. 

And unfortunately, programmers are notorious for, we say naming things is really hard and it is. And then we go and we name things, we don’t make it any easier on trying to bring people into what it is that we’re doing. So for those who are trying to submit a plugin into the WordPress plugin repository, first, find if you’re comfortable with the terminal and you’re familiar with the concept of the version control you probably won’t have any problem. But if you are intimidated don’t be afraid to ask on Twitter, or don’t be afraid to look on, I don’t want to say just Google anything because you will find some bad articles like the WordPress stack exchange or there are a number of people who blog regularly write about how to do this and I would say you know, tweet them or email them, read their post, things like that. And then try to get a formal understanding of what it is that you’re actually doing before you’re shooting your code into a repository. Because eventually, someone’s going to download your code, they’re going to find a bug and then you’re gonna have to update it and you’re not gonna be sure how to do it, and what to do when you may trash something by accident. And that’s completely normal, happens to all of us. But the first time it happens and it just doesn’t, it sucks.  It just doesn’t feel good, you get this feeling in the pit of your stomach and whatever. 

And so the process for it in my opinion is, since WordPress, since the repository uses subversion, I think that the guide for how to do it could be a little more flashed out in terms of submitting your first plug-in using tortoise SVN if you’re on windows or using versions of cornerstone if you’re on Mac or using the command line if that’s what you prefer. and then walk you through a hypothetical example, and then giving you maybe a sandbox to play with but we don’t have that. So the next best thing is to talk to people and there are plenty of people who are willing to help. I know that there’s people who will [inaudible 23:17.7] ignore you or whatever and you know that’s unfortunate, that’s how it is though. So when you find that person or those people, don’t be afraid to ask. It never hurts to ask and most of the time people are willing to help.

Joe Casabona: Yeah, absolutely. Well, 100% you know, it’s the worst thing, the worst thing that could happen when you ask somebody is they say ‘No’ and then you move on to the next person. But the community is very willing to help each other so definitely don’t be afraid to ask somebody.

Tom Mcfarlin: Right, agreed.

Joe Casabona: So we are, we’ve got a few minutes left. I know we’ve talked about the transformations a little bit, do you have any plans for the future with this plug-in?

Tom Mcfarlin: At the moment like literally, I have this source code up in front of me, I would like to improve the architecture of the plugin a little bit. My hands are tied somewhat by the base limitations of PHP or the minimum required version of PHP but I would like to make some improvements to the code. And also to the, well both in terms of the architecture and some things I would like to introduce in terms of features, you know, I don’t necessarily have a whole lot of like to add. Showing the name at the template is great but also showing the path. So the template I think would be helpful and possibly even linking that to the template in a file system could help developers. But I really do want to strike a balance between is this a plugin for developers or is it a plugin for bloggers or is it a plugin for just anyone who uses WordPress for any need. But I definitely know that I want to stay away from introducing like an options page. I love love love the activate and go. I don’t like it if you think there are no knobs to turn and buttons to press and the settings page is like I know my favorite kind of plugins are those that just work after you activate them. And so that’s a little bit of a longer answer. So you know, there are features that I am considering, there are architecture decisions that I’d like to make and I’d like to revisit. But I do know that one thing I don’t want to do is start introducing settings pages. That’s a definitive answer I can give.

Joe Casabona: Gotcha. I, but again I agree completely. You know, I know that some plugins require a settings page for whatever reason but the more plugins or I can just hit activate and then just be done with it are just my favorite kind, so cool. All right, well let’s wrap up here than with the last question my favorite question to ask is, do you have any trade secrets for us? 

Tom Mcfarlin: Oh man! I am sitting on a stockpile and it is taking me years and years to accumulate because when you’re working in the open-source economy where everything you do is out in the open for everyone to see, it is the easiest thing in the world to keep secrets. Honestly,  I wish I had something clever to say. As far as trade secrets are concerned, the best advice I can give regardless of this is really for people who are probably just starting with plugins or getting ready to market, therefore not market even but released their first plugin, there are two pieces of advice. 

One, find someone to help get the word out about it. Case in point, at this point there has been a commenting plugin out for some time called Postmatic, you can find it at gopostmatic.com. It’s a commenting plugin that makes it really easy to respond to blog comments via email. That is, someone leaves a comment on your WordPress blog, you get it in your inbox, you can reply, you never have to hop into your dashboard, that’s awesome. They have a lean version that was just launched called Replyable and it’s the linear version of that plugin, and it was covered by WPTavern. It will probably be covered by post status and some other podcasts or other blogs, or other blogs to promote it. Find some people that will help get the word out about it.

The second thing is plugins are more than code like stop thinking like a developer and start thinking like a user. And think when you go looking for a plugin and it comes down to two plugins that do the same thing. And one has a really nice icon and a really nice header image, and the readme seems to be really well-formatted, it’s written in everyday language, it sounds like you know, something that your friend or family member might say or explain versus this jargon and this, these bright colors created in some type of bitmap, which one are you gonna go with? So work with, uh you know, if you gotta pull up the money, pay a designer to help you come up with a brand and or have someone do some copyediting or just reading through what you’ve written, and then release it. Because having a really nice icon and really nice header image and a real and really well-written copy, that goes a long way in the entire end-to-end experience from “Hey, which plugin do I want to click activate?”.

And so one: find someone to help you get the word out about it, and two: have a designer and or copy editor you know, and I use that in quotes to help you prove what you’re about to push out for other people to see because the experience is not just after it is installed, it’s when they are looking for the plugin itself.

Joe Casabona: Awesome, well that’s fantastic advice. Tom, thank you so much for joining me today. I really appreciate it.

Tom Mcfarlin: Absolutely, I had a blast. I know that there have been some fantastic guests on this show and I feel honored to be one of them like I’m in some company that is far better than me so I’m proud.

Joe Casabona: That’s all, that’s basically how I feel about all of my guests. I’m very humbled that people like you and the rest of my guests come on the show and talk to me, so thank you again.

Hey everybody. Do you want to get out there and build something with WordPress? In my new course ‘How to Build a WordPress Themes: a Web Designers Guide’ teaches you just that. In the course, will learn how to take a static HTML site and convert it into a fully functional WordPress theme and plugin. We Will start with a little bit about PHP and how it works, will explore some great tools like underscores, and then we’ll take a static site and convert it to a WordPress theme. You’ll become familiar with underscores, you’ll learn how to customize blog posts, pages, header, and footer areas, and create custom menus widgets. You’ll build a plugin and you’ll even learn how CMB2, a popular WordPress tool for adding custom information works. And for a limited time, How I Built It listeners can get 20% off. Just go to buildpodcast.net/udemy. That’s builtpodcast.net/udemy.

Thanks so much for listening, and thanks to our great guests and fantastic sponsors. If you liked the show, please rate it and subscribe on iTunes in Google Play or whatever your podcast app choices. If you have any questions, be sure to reach out at streamlined.fm.

And finally, till next week, get out there and build something.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *