Build Your Own Business Website header image

Community Library Website – Case Study Part 3 – Custom Post Type Configuration

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 third in a series of live lessons on using WordPress and Thesis as a Content Management System (CMS). In this case study we are creating a community library website. We are using custom post types for different types of content. In this lesson we are looking at the advanced options in the Custom Post Type UI plugin.

Video Transcript

So we have this Community Library Case Study that we’re working on and Pam has sent me a list of essentially her database. This database has what, 3397 records in it and eventually, what’s going to happen is we’re going to turn this database into blog posts where each row is its own blog post and each of these pieces of data is going to be captured in a specific location. And let’s see, Brian’s got a question, let’s see. Okay and so the question is going to be…really, what do we do with each of these 3 things… or not 3 things… each of these things? What do we… how do we import them and how do we use them? And last week we talked about this concept of using custom post types as our content type for book reviews and for media. And then using taxonomies for certain kinds of organizational elements and then using custom post meta for other organizational elements. And so the very first thing we’re going to do is we’re going to talk about that.

Actually, that’s not the very first thing we’re going to do. The very first thing we’re going to do is talk about something I failed to talk about last week because I didn’t notice it. And so here we are at the Community Library Case Study and we’re going to go to the dashboard… fancy noodle 3.1 system here. And we are going to look at our custom post types. Remember, we created 2 custom post types – a book reviews post type and a media post type. And we set a whole bunch of settings. However, we did not set all of the settings properly because I missed one of the parts of this plugin. So we’re selecting custom post types from that custom post UI plugin. So here we are at our custom post type UI page and we’re going to manage our post types and the first post type we’re going to manage is media so we’re going to select edit. And then, we looked at these advanced label options but I didn’t recognize that this was a separate link, the advanced options. And so we missed out looking at these things so I want to talk about these things for a few minutes because there are some settings in this advanced options that we want to change.

This is how it was set up automatically by default. So the first question is, is this a public post type? And what that means is, is this going to be publicly displayed? And you might be surprised that there is such a thing that you don’t want publicly displayed but in this case we say, it’s true. The next thing is do you want to show a UI? And showing the UI has to do with showing this little book reviews and media elements or menus and again, you can create custom post types without having these UIs which will make editing them quite a bit more difficult. But you know, if you’re just editing via software programming anyway, perhaps it doesn’ t matter. So anyway, it can be publicly displayed in the UI or not. The next question is, does it have an archive? And in particular, that means will it display similar to a you know, post tag or post category archive? And this is set to false but really, we want this set to true because we want to be able to do archives of these custom post types. And so, this definitely needs to be set to true.

The capability type, we’re just going to leave as post. The you know, this is actually kind of a complicated little issue and if you just leave it always as post, that’s generally going to be good enough for you. Now, whether it’s hierarchical or not is whether or not it’s going to act like pages or posts. Right now, we’re saying hierarchical is false and so it’s going to behave just like a post which means, you’re not going to have a post and a subpost of a certain post. Or you know, a hierarchical structure would allow you to have a page and a subpage and a sub subpage and you’ve got parent-child relationships that you can establish between the individual posts. Pages in default WordPress pages are hierarchical posts or not, we don’t want ours to be hierarchical then it’s false. The next thing is this ability to rewrite the slugs so that your URLs can look the way you want them to look. We’re going to leave it at true and so, the rewrite rule is going to end up putting media in the URL name. Now, that really isn’t… in the library, I don’t think that is particularly important. In other kinds of sites like the Community News site, the rewrite slug is quite important because you’re really concerned about people searching via Google so that rewrite slug has a lot to do with search engine optimization. However, in our case you know, our searchers are going to be already on the site and they’ll be searching for documents on the site. And so the slug doesn’t really have any effect on that.

Okay the query of r is are you going to allow this post type to be queried? And yes, we do want to be able to query it and we’re going to do that. Menu position is where do you want these things to sit in this line? And let’s see, and so for example, right now, book reviews and media are below comments. And this is the default position for them, each one you know, goes into the order it was created and it goes under comments. However, you can change this to be in other locations. For example, we could take book reviews or media and move it up all the way under posts. And if we’re going to do that, we want to give it a menu position of 5. If we take a look at the codex article for this for a second, the codex article in the menu position says 5 gets you below posts… let’s just close this up and we can sit here beside this… 5 gets you directly to below posts, 10 gets you below media, 15 gets you below links, 20 gets you below pages, 25 gets you below comments. That’s where we are by definition or by default. 65 puts you down below plugins, 70 below users, 75 below tools, 80 below settings, and 100 goes below… you know, I don’t know what the 2nd separator is. That’s an interesting… it’s probably down here at the bottom. So what we want to do is we want to put this right up under posts and so, I’m going to say that is 5. We are definitely going to show it in the menu and we want it to support a title and an editor which is like an author, essentially who can edit the file. An excerpt… you know, I don’t think we’d care about trackbacks so we’ll turn that off. We definitely care about custom fields because those are the same thing as custom post meta so we want that. We want it to support comments, we may as well support revisions for a while.

Thesis does not use the feature image and so, we could deselect that but I’m going to go ahead and leave it there for the moment. We could include… it could support author but you know, I don’t think it really matters in this case, whether or not you know, who the author is of the… added the data. So we’ll leave it there in any case. And then, page attributes. Now, page attributes are the things that come over here under edit page so if we look at add new book review, open like a new tab… these are the attributes. And so those attributes could be you know, their order in the menu. They could also be template styles and things like that so that is what the attributes are. And then you want to know whether or not you assign built in categories or post tags and we’re not going to do that. We’re going to use our custom taxonomies for this stuff. So we’ll go ahead and save this custom post type now and then now you can see that… well, media right. Oh my gosh, look at that – media and media. That you know, that one didn’t hit me… that we’re going to have to name the same thing. Anyway, I didn’t see that coming but anyway, that’s what we do. We moved it up.

So that’s what I wanted to show you. We can do exactly the same thing with book reviews really quickly without talking about it at all again. And that just means that we’re going to give it a true for archive and we’re going to give the menu position of 5 and we’re going to save the custom post type. If anybody wants to ask me a question about this, feel free to raise your hand. I’m happy to give a more thorough explanation of what’s happening here if you like.

So let’s see… okay so now we have posts, media, and book reviews showing up here. And you know, we could change this to books media for that right there. Let’s do that. Let’s edit this. Go to our label, I think this is it here… books/media. Let’s save the custom post type and let’s see if that does it. No, it doesn’t do it. Oh, maybe it does. Yeah, books/media… there we go and so, perfect. And we could change this label too but any case, books/media… that makes it a little bit easier to swallow, I think.

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