Stop Writing Stupid Tutorials

Stop Writing Stupid Tutorials

I’m going to start you guys off with a quote today, signed the always excellent Konstantin Kovshenin:

Is it considered “cool” to copy/paste all my plugins into my theme’s functions.php file?

Now why would he write something like that? It is part of a paragraph (obviously) that makes fun of all these “paste this code into your theme’s functions.php file” tutorials out there. Sarcasm all around, and you all know how I love that shit. And irony, irony is also great fun. Ironing, not so much.

I’m sure I don’t need to tell you, dear reader who adore me more than anything in the whole wide (wild?) world, that filling your functions.php file with code you found using Google and a more or less accurate search query is a bad idea. You know this. You don’t put anything in functions.php unless it truly belong there.

Granted, not everyone agrees on what actually belongs in functions.php. There might even be a time when things that usually belongs in plugins makes more sense in functions.php, it would all depend on the project. I won’t condone such thinking in this column.

Also, I’m high on caffeine.

JP7EQ6e5d1c

So you know that you shouldn’t post everything in functions.php, Kovshenin certainly knows it, and I’m pretty sure your grandma’s cat has a pretty good idea what features needs to be portable and what goes in functions.php too. We all know it, right? Right. Still, since Google will find this post and confuse the hell out of people, I’ll spell it out in two simple rules:

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

  1. Functionality that is entirely unique to your theme should be in your theme. That includes your theme’s functions.php file, obviously.
  2. Functionality that you would want to keep when changing themes should be in a plugin, since that wouldn’t disappear just because you activated a new theme.

Got it? Good.

Problem is, people who are writing WordPress tutorials doesn’t. And those tutorials will be published online, I hear this is the latest thing but wouldn’t know for sure since I’m submitting my column via a secretary who prints them out on a typewriter and send them via pigeons to wherever it is that this very site I’m apparently writing for is located. In fact, just last week I learned that you can find these words of mine on the internet. I thought this was a printed magazine, because surely that is something we need about a web publishing platform, right?

Actually, maybe we do. I just wouldn’t buy it. It would probably feature tutorials telling me to paste stupid code into my theme’s functions.php.

So, to conclude: Stop writing these stupid tutorials!

Shameless self-promotion: If you’re so inclined, I’m covering this in the third edition of Smashing WordPress: Beyond the Blog.

Photo credit: Daniel Finnerty (CC)