This is the twenty third in a series of live lessons on using WordPress and Thesis as a Content Management System (CMS). In this lesson we take 4 custom post meta elements that we added to our post display in part 21 and remove them from the normal post display. We are adding “location”, “call number”, “ISBN” and “Publication Date” to the display of our custom post type and we are adding language that makes it apply to the custom post type only.
So then the next thing we’re going to do here is we’re going to fix my little problem on this post. Notice again, if you select this post I created, it’s got listed under topics and audience and can be found in and call number and ISBN and publication date. We don’t want that stuff to be added to this.
So we got to go back to our custom php file and if we scroll down here, this is the one that added the subtitle and the author name to the post heading. And so, what we’ll do here is we’re going to complicate this query a bit by saying if is single and if the post type = catalog items.
Now I just answered a question like this on the DIY Themes forum here earlier and unfortunately, there is no conditional tag that is equivalent of if is single. So what we have to do here instead is we’re going to add a thing called get post type and we’re going to say and let’s see, catalog items. Okay and catalog items equals and then it’s going to be… I think it’s get post type.
So what we’re doing here is we’re asking if it’s a single post and essentially, if the post type = catalog items then add this to it. We need to make sure I guess, that that is exactly the right name for our post type. Catalog items, yes, okay… hyphen catalog items. Let’s just double check my get post type for a second here. Yup, it is. Get post type… oh, I need to put the current post in there though.
So the way we do that, I forgot about that. Global post and so, this is where we’re going to use that post id again, control copy. We’re going to put that right there equals get post type post id. So this is our current post id. And let’s just… you know, it’s not going to show up well for this because we don’t have any standard HTML that’s being output there if there’s no content. So let’s try this also on the one below which is where we put… oh no, this is it. Yeah, that subtitle. Topic tags and audience taxonomy, if is single. Okay, we could paste that there and I guess, we paste it here too because it really exists in all 3 of these places, doesn’t it?
Let’s see what happens. Let’s hope it doesn’t just crash the site. Okay, we upgraded that, we upload this, we come back over here… okay well, it didn’t crash. Okay, that worked. So if we come back over to one of our catalog items just to make sure that works… yeah, it still works. We’ve got our subtitle and our author and our stuff at the bottom. So, that was a solution that works.