A month has passed since my first time attending WordCamp NYC 2014 in good ‘ole Brooklyn. It was a new experience, admission was cheap, and I still don’t know what to do with all the stickers and buttons I admittedly hoarded from the booths. ( I have this thing where if it’s free, well hell, I think I’ll help myself, thank you. ) In all seriousness, the entire conference was awesome and totally worth it. Only from attending on Saturday, I’ve decided to become a WC NYC attendee forever!
Being a WordCamp noob, there were a few things that surprised me, terrified me, and all in all, a lot that I learned from the adventure that I hope to share with people thinking of trying it out as well – or people just wanting another perspective on it.
Ever wonder how to add counter/numbered classes to your posts? Is this the fourth post or the seventh? Well, if you have wished upon a star (or even if you didn’t, but it was more like cursing out your computer, that’s fine too), then your wish is about to come true with this tutorial.
In this tutorial’s example, we want our blog posts to have classes like “article-number”, and we can achieve this using the post_class(); function and a counter that we’ll set as a global variable.
It’s not as hard as you think. Also, keep in mind that this is a technique that can be applied to other scenarios too, and it’s not limited to just adding classes to our blog posts. Well, let’s get started, shall we?
Before we begin:
Some familiarity with loops and general PHP will help.
There are only 2 files that are actually required in a WordPress theme for it to be detected and applicable in WordPress. Those 2 files are style.css and index.php.
And then there are those “unsaid” files – those “secret” requirements that become the scuttlebutt amongst developers and are the difference between a good quality theme or “What noob built this thing?!”
So how far do you go? Aside from the required WordPress theme files, what files should actually be present in a theme regardless of whether they’re literally required and why? Well I’ve gone through a fair share of WordPress builds, and I’d like to share my thoughts on that.