Build Your Own Business Website header image

Community Library Website – Part 55 – Add Sort Order to Custom Taxonomy

Difficulty Level -

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

This is the 55th in a series of live lessons on using WordPress and Thesis as a Content Management System (CMS). In this lesson we add a sort order to our custom taxonomies by means of a modified version of the My Category Order plugin. Once we’ve modified the plugin, we add that sort to our code.

Community Library Website – Case Study Part 1 – Site Organization
Community Library Website – Case Study Part 2 – Create Custom Post Types
Community Library Website – Case Study Part 3 – Custom Post Type Configuration
Community Library Website – Case Study Part 4 – Custom Taxonomy Decisions – Theory
Community Library Website – Case Study Part 5 – Custom Taxonomy Decisions – Practical Application
Community Library Website – Case Study Part 6 – Incorporating Existing Data Into the Project
Community Library Website – Case Study Part 7 – Creating Hierarchical Custom Taxonomies
Community Library Website – Case Study Part 8 – Creating Non-Hierarchical Custom Taxonomies
Community Library Website – Case Study Part 9 – Creating Custom Post Meta
Community Library Website Case Study – Part 10a – Restore the Database Using BackupBuddy
Community Library Website Case Study- Part 10 – Creating Custom Post Meta – Continued
Community Library Website – Part 11 – Importing Existing Data to the Website
Community Library Website – Part 12 – Prepare Existing Data for import by the CSV Importer plugin
Community Library Website – Part 13 – Import Existing Data Using the CSV Importer Plugin
Community Library Website – Case Study Part 14 – Date in Permalink Configuration
Community Library Website – Part 15 – Importing Images
Community Library Website – Part 16b – Final Data Import
Community Library Website – Part 17 – Add Thesis Post Meta to Custom Post Type
Community Library Website – Part 18 – Add WordPress 3.0 Menus
Community Library Website – Part 19 – Add Post Meta and Taxonomy Information to the Post Display
Community Library – Part 20 – Add topics and audience to book display
Community Library – Part 21 – Display the Rest of the Post Meta in the Post
Community Library Website – Part 22, Create the Permalink Structure
Community Library – Part 23 – Remove Custom Post Meta from Post Display
Community Library Website – Part 24, Add Taxonomy and Post Meta Data to the Teaser
Community Library Website – Part 25, Add Taxonomy Data to the Teaser
Community Library Website – Part 26, Adjust the Teaser Styling Using Design Options
Community Library Website – Part 27, Styling the Teaser Using CSS
Community Library Website – Part 28 – Fine Tune the Teaser Display
Community Library Website – Part 29, Designing a Custom Catalog Page
Community Library Website – Part 30, Using a Query String in a URL
Community Library Website – Part 31, Adding Custom WordPress Menus
Community Library Website – Part 32, Add Custom Menus to the Catalog Page
Community Library Website – Part 33, Add Another Custom Menu to the Catalog Page
Community Library Website – Part 34, Troubleshooting Custom Menus
Community Library Website – Part 35, Add Styling to WordPress Menus
Community Library Website – Part 36, Add HTML Markup to WordPress Menus
Community Library Website – Part 37, Add WordPress Menus to Archive Pages
Community Library Website – Part 38, Add and Style a List of Tags
Community Library Website – Part 39, Add a Search Box to the Sidebar
Community Library Website – Part 40, Add Links to the Sidebar
Community Library Website – Part 41, Add Taxonomy Drill Down Browsing
Community Library Website – Part 42, Custom Loop to Display Custom Post Types
Community Library Website – Part 43, Simple Custom Query
Community Library Website – Part 44, Custom Taxonomy Query
Community Library Website – Part 45, Add Thesis HTML Structure to Teasers
Community Library Website – Part 46, Display Posts from the Last 60 Days
Community Library Website – Part 47, Custom Loop If Have Posts
Community Library Case Study – Part 48, Increase the Number of Posts that Display on the Custom Catalog
Community Library Website – Part 49 – Naming Conflicts in Custom Taxonomies
Community Library Website – Part 50 – Find and Replace Semi-colons in the Database
Community Library Website – Part 51 – Modify Taxonomy Names Directly in the Database
Community Library Website – Part 52 – Sort Posts by Meta Value
Community Library Website – Part 53 – Show the Term Label Only when a Term Exists
Community Library Website – Part 54 – Sort Archive Posts by Meta Value
Community Library Website – Part 55 – Add Sort Order to Custom Taxonomy

Video Transcript

Rick: Okay so then the next thing we’re going to do is we’re going to sort these taxonomies and Pam, I’m going to unmute your microphone now for a moment. And what you want to do as I understand it is you don’t want…right now, the taxonomies are being organized alphabetically, right? So Bible and Reference comes first and then Biographies comes next and DVDs comes next and so on and so forth.

Pam: Right.

Rick: And so, what you want to do is pick a specific order for those things.

Pam: Yes, that’s correct.

Rick: Okay so think about that order for a moment while I show you how to do it, okay?

Okay. I’ll turn your microphone back on and we’ll talk about the order. But first, I’m going to just do this thing here. So we’re going to install a plugin. Let’s see, it’s called My Category Order and then we’re going to replace a bunch of its functions so that it will work with taxonomies. So let’s select Add New and say My Category Order and we’ll install it. Activate the plugin and now, if we come over here to My Category Order, we don’t have any categories to organize so you can’t see them here. And this only orders categories at the moment so it’s not pretty exciting looking but once we swap the code out, it’s going to be great.

So the next thing to do then is to come back over to our Filezilla and I am going to download My Category Order to my local machine here. And then I’m going to open the file…oh no, not open project. Pardon me, open file and then tutorial sites and the library, content plugins, my category order and then we’re going to take mycategoryorder.php. We’re going to open that up and then I’m going to come over here to my site and do the same thing. Plugins and My Category Order and we’re going to open up mycategoryorder.php and we’re going to take all of the content here. Now, what you’ll be doing is you’ll be taking this out of the forum. We’re going to take 100% of this content and we are going to replace 100% of the content that comes with the plugin with that. Save the document, upload it, My Category upload. And now, through the goodwill of others, if we refresh this screen, now you can change your taxonomy. Instead of categories, now what we’re going to do is change locations. So we change the taxonomy and now what you can do is you can drag and drop these things around. So Pam, yes I am going to post this code. Pam, I’m going to turn your microphone back on. So Pam, how do you want this thing organized?

Pam: Oh well, let’s see. Let’s put Audio just arbitrarily of course, just for the moment, let’s put Audiobooks at the top and is there a Children’s Audio? Oh you don’t have Children’s Audiobooks, okay.

Rick: No, I don’t.

Pam: Well, let’s move DVDs up next and then Fiction down here at the bottom. Then Non-Fiction and…oh I guess, in any order, the rest of the Adult Categories. I’ve tinkered with mine so much that my categories are different than yours and that doesn’t matter of course. And let’s not put… well, Storage wouldn’t be new. Anyway, Storage can just…

Rick: Yeah, just go down here at the bottom.

Pam: Yeah. We don’t have anything in Storage.

Rick: So now if we hit click to order categories…

Pam: That is wonderful.

Rick: I think we did it. Categories are updated successfully. Now, we need to change our code a little bit and the place we change our code… oh, pardon me. This is code that we can close. The place we change our code is up here when we get our location names, right? We have get terms location. What we’re going to do is we’re going to add a new argument to this. So in fact, what we’re going to do is we’re going to move this up for a second here and what we’re going to say is args. Let’s see, actually I think I’m going to make this location args. Okay and then up here, we’ll say location args equals array. And so, it’s going to be fields space space… come back to that. Do a little arrow and then so fields equals names and then comma, drop down, tab tabtabtab and then it’s going to be not fields but order by and equals arrow space. And then we say term order. Because what has happened here is that plugin created a field for all taxonomies called term order. And so now, we’ve said okay now what we want to do is order it by the term order. So now what we have to do is save that. So it’s a very small change to the code. We save that, let’s see… we got to go back to where we are. We upload that and we go to our site and let’s see… and we just go look at it. We go to custom catalog…maybe it’s not term order. Maybe I was mistaken. You know, I must have used the wrong syntax there. Term order, oh no… this is what I get wrong. There’s no space in there. Order by is what it is. Save… I think I’m going to get by tonight without failing at anything which is going to be just terrific. Okay, there we go. DVDs up at the top, now Fiction then Non-Fiction and yeah… lots of non-fictions there. Bible and Reference, so on and so forth. So we nailed it. You happy with that, Pam?

Pam: Yes, that looks great.

Rick: Did you get a new internet connection?

Pam: No, why?

Rick: You know, because whenever I talk to you, you know, there’s this weird sound in the background that sounds like somebody’s flushing the toilet although it’s obviously not. You know, I just assumed it was Clearwire and in fact, I have had that with other people when I’ve talked to them on Clearwire. But it hasn’t been there at all tonight. So I just assumed..

Pam: I changed my audio set up from default to specific for the brand headphone I’m using.

Rick: Well, that’s probably what it was then because it’s perfect now. I used to have to turn you off because I didn’t want to you know, have this sound in the background too much. That’s great. Okay well and is there anything you want to ask about any of those things?

Pam: No, that is great and that will fix the sorting problem I was having with those buttons. So it’s wonderful.

Rick: Perfect.

0 Comments… add one

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
THIS IS A LIMITED TIME OFFER!
Subscription Options
0 comments… add one

Leave a Comment