Try not to write clever code

Here is a thing I wrote yesterday:

The purpose is to remove the topic and reply forms from bbPress conditionally ( that add_filter is actually used in an if statement). However, it turns out there is a little simpler way to do this. Look:

That’s it. Nothing else is required. Remove the rights to publish posts and replies and the code above is absolutely unnecessary.

The lesson I keep learning

Whenever you think you’re doing something clever, make sure you aren’t writing useless code for the sake of writing code. Write the code to achieve a result, not to increase line count in your files. Sure – both approaches above achieve the result, but if I had given it enough thought yesterday, I wouldn’t have to write this blog post today. That’s my exactly my point – give it some thought. Don’t rush to write moar code.

Get the moderator role in bbPress

I don’t work with bbPress that much, but when I do – every time I spend most of my time hunting for functions. I wish there was some sort of documentation developed over the years, but it hasn’t, and I know, I know – I haven’t helped much either. So at the very least, I decided to write down some of the common things I do with bbPress, starting with getting the moderator role.

It is really that simple:

That’s it.


Turns out there is a function called


Ooh! Caps short for capabilities! I get it. That’s cool….when you know it.


I would never, ever, ever have discovered that by guessing function names. I had to search files for the word “moderator” to eventually land on this piece of information.

Anyway. Now you know, and so do I. Caps are capabilities, and checking a moderator is as easy as current_user_can('moderate').


Managing z-index without loosing your hair

I’ve run into issues time and time again managing z-index. Sure, most of the time, z-index related issues are far from complex.

However, I’ve come to a passionate dislike of magic values and numbers. What is 58 or 3000 after all? It’s an arbitrary number. Wouldn’t it be a lot nicer to have layers in CSS, just like in Photoshop or Illustrator ? More

Easier way to make sure all strings are escaped in WordPress themes

We all know we should escape all the strings in a theme. WordPress theme review guidelines require it, and so does Themeforest.

After working on a theme for a longer period of time, it’s quite possible that you’ve slipped somewhere with unescaped echoes. If you’re going commando on your own – you still need to escape every little thing and be twice as careful if there are no additional set of eyes on your code. More

New Everything

New Design

Thanks to WP-SBVTLE I’ve got a nice theme for myself. I will probably make a couple of edits now and then, but finally I feel like writing.

The default WordPress Twenty Twelve (or thirteen) aren’t bad themes, but I just wanted something more like… well – like this.

New Host

I’m still in the process of moving, but I’m finally moving from Rackspace to WPEngine. I’ll post about that later on, but so far my experience with WPEngine has been truly amazing! They are awesome!

New Header Image

Well. Previously I didn’t have one, so theoretically it’s not new, but I’ll count it as new. I took the Elephant from The Noun Project, designed by Ted Mitchner.

New Writing style

Yes. This was a short post. I hope to keep writing nice little short posts to get into the habit of writing.