This is the 16th in a series on using WordPress and Thesis as a Content Management System (CMS). In this case study we are creating a community news site. We have created a static page to display our upcoming events sorted by the event date. Now we are going to add the display of the event’s venue. In other words we are displaying custom post meta in the post.
Case Study Part 1- Community News Site, Custom Taxonomy vs Custom Post Types
Case Study Part 2 – Community News Site, Setting Up the Test Site
Case Study Part 3 – Convert Posts to Custom Post Types
Case Study Part 4 – Configure Permalinks for Custom Post Types
Case Study Part 5 – Install and Configure Thesis
Case Study Part 6 – Listing Custom Post Types on the Appropriate Page
Case Study Part 7 – Community News Site Future Refinements
Case Study Part 8 – Add Thesis Meta to Custom Post Types
Case Study Part 9 – Display Custom Post Types by Category
Case Study Part 10 – Create Category Display Order
Community News Case Study – Part 11 – Add Event Information as Custom Post Meta to Events
Community News Case Study – Part 12 – Create a Page with a Custom Loop to Display the Events Sorted by Date
Community News Case Study – Part 13 – Display Event Date on Teasers
Community News Case Study – Part 14 – Show Only Upcoming Events
Community News Case Study – Part 15 – Format the Display of the Date
Community News Case Study – Part 16 – Display Event Venue
Okay so then the next thing we want to do is add the event time. Actually, we’re going to skip time for a moment because we’re just about running out of time. I’m just going to put in venue here so that we can get this done.
So echo and it’s not time, it’s actually…we’re just going to echo event to venue. So we are going to echo event venue and then…well, let’s do that first and then you can see how we’ll need to add some HTML to this in order to make it work the way we want it to work. So let’s upload it and then let’s refresh it. And let’s see, not many of these actually have a venue specified. Oh, did I fail to save it? No? Event venue equals get post meta, post id venue echo event venue. Well, that’s interesting. That should have worked just fine.
Let’s take a look at New Offensive Drivers Driving Class and then let’s edit the post and let’s give it a venue, Edmonds Sr. Center. Okay and let’s update it and then let’s go back up to the site and to that page. And it’s not… it’s showing the date but it’s not showing that. And event venue equals get post meta post id venue. You know, I’ve got some little something here. Did I misspell it? You know what, I bet I did. I bet you’re right, Dennis. Let’s just see what I did with that. Thank you for noticing that.
Okay let’s look at verve meta boxes. Yeah, oh gosh. Thanks Dennis. You’re absolutely right. What would I do without you guys catching my typos? You know, I would sit here scratching my head is what I would do. Event… okay let’s just change that to venue and venue just to get our spelling straight. It’s going to work fine now. We had to go upload and then go back to events. It should work now, eventually. There it is, okay.
So there’s the date and then it butts up right against the Edmonds Sr. Center, it butts up right against that. So we’re going to add a little bit of HTML and then we’re going to call it an evening. And so, in this case, we are going to echo… let’s see. Echo p… I forgot. I need to put these in quotation marks, space dot space, echo p and then time colon. And then this little period, that’s the concatenation symbol so it’s going to take p time colon space and then put the time in. And then we may as well, here, add the closing p to that…./p. Of course, I need those single quotation marks around that. And then we are going to, again, space and we’ll say p and then location colon space and then space period space single quotes and then the closing p tag again. So we have an opening p tag and closing p tag for each of those things plus the time and then the location. If we save that and if we upload it, we’ll probably want to do some custom CSS to it but it should actually work just fine.
There you go. See, so time, June 4th 2011, location: Edmonds Sr. Center. So we’ve got that information to display. If we had more time perhaps next week, what we’ll do is we’ll add this to the post because you can see that it does not show up on the post. That little bit only showed up on… well actually, let’s just do that right now.
We’re going to add action here, copy. We’re just going to add exactly the same thing but it’s going to be Thesis hook after headline instead of after teaser headline. So we’re going to add exactly the same function here twice but once… it’s either going to be the teaser or it’s going to be the headline. So we save document and we upload the document. We’ll go back and look at that post. We refresh it, there we go. Time: June 4th location: Edmonds Sr. Center so that’s what it is we have to do and we’ve come to a close.