Orderby Custom Field

I’m getting along pretty well with WordPress so far, and I’m still amazed to hear myself say that I actually enjoy it. But while I have plenty of CMS experience and even know PHP pretty well, I’m still a bit of a WordPress newb. This one still sort of has me stumped.

Using WP_Query to get a custom taxonomy and orderby a custom meta value

To someone not versed in WordPress speak, that sounds like a bunch of hooey. But all I want to do is get all posts from a category that I created and order them by a custom field that I also created. Like any good WordPress newb I turned to Google and came up with this:

In my mind that totally should have worked. But it was actually ordering the posts by an older custom field that I had deleted. By using Query Monitor I was able to see that it was still sorting by this old query—I still don’t know where it lived. Anyway, after a sleepless night and a few more hours of table-beating with my head, I tried simply removing the post-type parameter:

And boom! It worked exactly as expected. My only hang-up is that custom taxonomies can be mapped to more than one post type, so what if I really did need to indicate a single post type? Oh well. I guess I’ll find out when that need arises.

Howdy, World!

This is the obligitory blog post from a not-famous-at-all web designer who writes a blog post once in a blue moon about moving from one blogging platform to another. So it all started with a little blogging platform called Textpattern

Those were good times. I built a blog using Textpattern and participated in the community a bit. I even used it for some client work. It wasn’t long, however, before I realized that something more robust was needed for client work. How I found ExpressionEngine, I can’t remember, but its discovery opened up a whole new world. Whereas Textpattern had custom fields through the means of a plugin, ExpressionEngine was all about custom fields and organizing content however you preferred. Yes, ExpressionEngine is amazing, but it’s really big. And yet I built another blog using the free version and wrote a couple of short posts. And then my blog died.

I have no idea what happened, but I didn’t care enough to try and fix it. So this domain had a dead website for quite a while. Now let’s fast foward to Node.js and the popularity of static site generators. I had been using Node along with Bower and Gulp for local development tasks, and it was fun. It’s still fun. So that started the search for a “fun” JavaScript blog generator powered by Node. I tinkered with a few, but the simplest for me was Hexo. After installing and customizing a theme to my liking, here I sit writing my first post.

So, after all of that, I’ll be really honest about two things:

  1. I’m not a very prolific writer by any means, so don’t expect a post every week or even every month. Or every six months.
  2. When I do write something, don’t expect it to be Pulitzer material.

And away we go!