After analyzing the issue in part 1, we determine that a custom post type will solve the problem. Then we discuss how the parts of the custom post type – post content, post title and post meta – will work together to achieve the system needed.
Video Transcript
Rick: Okay so then I’m going to change what I suggested here and what I’m going to suggest is that your custom post type is for all of yoru court cases. And now, the first reference or the full reference is no longer the post content. This is now post meta as well. And the post content will be your whole case, right? So yo’ull have a title which will be your post title which willb e your naming convention.
Reese: So it gets embedded in the original post.
Rick: Yes, all this stuff… you see the thing is that you know, good data design has you only entering the data one time.
Reese: Exactly. After working on about 30 of these, I became a firm believer in that. I got tired of retyping a bunch of these cases.
Rick: Well and so since you only want your data entered one time, even those ones that you’re not going to include the full case in, you still want to capture those in the same format. It may not have any content but it’ll still have the…
Reese: Right. They’ll still have post meta.
Rick: They’ll still have the post meta. They’ll still have the short names of some of the links. And actually, the link is no longer going to be post meta, right? Actually, link is going to be but instead of link, it’s going to be link yes or no. And this is a check box that says, “Do I want to include the link to this case when I make a reference to it?” And most of the time, it’s yes. But these ones where you’re not going to have any content in them, that’s a no. And you would… this post meta is going to be created when you create the court case itself, right? So this is now just a switch that says, “Yes, include the link to this one in a reference” or “No, don’t include the link to this in the reference”.
Reese: Yes, it’s just a Bolean.
Rick: Exactly. So now you have your reference case that has… or it’s no longer a reference case. This is now your court case.
Reese: Correct.
Rick: And every court case that you reference is going to be treated the same way and it’s always going to go in their custom post type called court cases. And the title of the court case is going to be… or right now, we have it as your name convention and you probably don’t want that, do you?
Reese: Well, it’s going to be… go ahead.
Rick: We will do that. We’ll keep it as the post title will still be your name convention and what we’ll do is we’ll have a long name. Or I don’t know, maybe it’s a short name that shows up at the top of the page when somebody goes to the post. So you don’t necessarily see the title. The title is now not for them. The title is now just for you.
Reese: Okay.
Rick: So that when you’re looking at your pages, just like me, I’m looking at my Live Answers… when I’m looking at my Live Answers, these titles are all… well actually, these titles are for you too. But you would use this title only for your purpose and nobody but you would see this title.
Reese: Right. See, I guess I can even make that a private post.
Rick: No. You’re going to treat all your data exactly the same way. These data is all going to come together and one thing, it’s never going to be private. It’s always going to be public. And the difference between those with content and those without is this check box.
Reese: Okay.
Rick: And so post title would stay a name convention. Short name then might be the name that gets displayed at the top of the post when somebody goes to that post.
Reese: Well, the short name is only used you know, if I’m typing, I just say… instead of saying Welch v Helvering full reference… da da da da… I just type that along and then I just have an anchor tag surrounding that short name.
Rick: Right. I understand that. But my point is that when we’re trying to think of the standard WordPress parts and how those standard WordPress parts relate to the data you want to capture and display.
Reese: Basically, when I’m doing tables of authorities or if I’m having to refer to these things you know, I don’t want to… what I’m really trying to do is save myself a lot of time and a a lot of trouble when I’m doing these anchor tags and generating these tables of authority.
Rick: Well, let’s restate that. What you’re really trying to do is you’re trying to have a…
Reese: It’s being lazy.
Rick: A rational data structure where the data is always only entered one time and it’s always stored in only one place. It can be retrieved anywhere and it can be displayed a thousand times. But it’s the one piece of data that’s captured and stored in only one place.
Reese: So would I still use a shortcode then to refer to that full reference?
Rick: That’s irrelevant, right. So you would definitely still use a shortcode. What I’m trying to get you to do is to think about the WordPress pieces and how the WordPress pieces can satisfy your data need. And right now, the way I see this is… let’s see. I’m just going to capture this too because you also have a data need for content. So this is the full case content. You have that data need as well and this is going to be post content. So you need to capture and manage 5 separate pieces of data about each court case. You need to capture its naming convention which is what you’re using to find it…
Reese: Which I’m already doing.
Rick: Okay, you need to capture whether or not you want to link to the actual court case in a citation. You want to capture its short name. You want to capture its full legal reference and you want to capture its full case content. And we are using 3 different WordPress elements to accomplish those things. We’re using post title, post content and post meta.
Reese: Got it.
Rick: Okay so then back over to this, we still need to create the custom post type. We need to create the custom post meta and we need to create the shortcode. And now your shortcode will look like… it’ll be citation and then title and we’re going to have to go back to content. Actually, we don’t have to go back to content. We could say citation as one and then the second one would be… I don’t know. We could just call it short. We could call it short and long. Okay and then short title equals… and then this is your naming convention or long title = naming convention. The long one will have a link as long as the post meta says “Yes, link to it.” The short one will have a link as long as the post meta says link to it. Otherwise, it won’t be a link. It’ll just the short title and the long title.
Reese: Now, is there a way…you know, some of these names are pretty gnarly. You know, like Welch v Helvering, Skills vs United States… v Commissioner of Internal Revenue. Is there a way that I can… instead of referring to it by the… when I’m doing the shortcode, instead of referring to it by the post title, is there a way that I can refer to it by my code name?
Rick: Well, that’s the name convention, isn’t it? Isn’t the name convention like code name?
Reese: Well, instead of referring to Welch v Helvering, I just refer to 1933-welch, 1925-mckenna.
Rick: Right and that’s what I’m saying your post title should be. Your post title should be your name convention.
Reese: But my post titles are very long.
Rick: No, no. The post title will be short. What looks like a post title to the person who reads it, that may be long. But for your purposes, you’re looking at your post title here. You don’t need a long post title here, right? You want to be able to find the right one quickly.
Reese: See, that’s where it says Welch v. Helvering. That’s where it says…
Rick: It doesn’t have to though. That’s why I’m saying… what we’re trying to do is…
Reese: I trust you.
Rick: But I want you to understand why I’m saying that the post title is not the name… the short name. The post title is your naming convention. And the reason why you would do that is because you want to be able to find you personally as y are working on this since you’ve got a few hundred of them. You want to be able to look through this very quickly and find them. And the long names are going to be impossible to do that with.
But I want the… on the permalinks, I want it to say courtcases/welchvhelvering.
Rick: Okay, point taken. Point taken.
Reese: So if there’s a way that I can adjust my permalinks then I’m game.
Rick: Yeah. We want to keep as many standard WordPress functions in place as possible here. And so your name convention is now going to be post meta and your post title as going to be your short name. And the… I mean actually, the one thing you could do obviously is when you create one of these things, you have the power over the permalink by editing it here, right? So you could actually put the… whatever you wanted in here and it does not have to reflect this.
Reese: Correct. But when someone clicks on it and it comes up with the post, I don’t want it to display the 1925-mckenna, the 1933-welch. I want it to show the Welch v Helvering though.
Rick: Right. So what that means is that in our… well you know, I mean, I’m making our job harder, the job of doing this harder by trying to make yoru job of sorting through these things easier. When you’ve got… I mean, I have 532 items in this list. I’ve got 532 Live Answers. And so if I want to find a specific Live Answer in 532, I’m not going to do it by scanning. I’m going to have to do it by searching.
Reese: Yeah. See, most of the… we are talking about court cases. So most of the time, people refer to it as the Cohan Rule. Well, there’s only… there’s one Cohan case… there’s actually 2 Cohan cases and there is one Cohen case which is spelled very similarly. But that’s you know… Yes, I have relatively short post name because it’s either going to be… see, I’m not putting in their first name and if they’ve got their wives’ name in it and all that. I’m not getting all that tangled u pin it on my post title. Although it does show that in the post content but it doesn’t show that in the post title. But you know, if I can get away with typing 1925-welch instead of welch-v-commissioner, I sure wouldn’t mind it.
Rick: Yeah.
Reese: When I’m having to do the shortcode part, yeah. But it’s not a deal breaker but it… and…
Rick: Well, when you’re… we’re going to use your naming convention here. We want it to be as short as possible.
Reese: Yeah, yeah.
Rick: The shortcode should be as easy to type as possible and have as little opportunity for errors as possible. So if we have long title equals…
Reese: If you’ve ever tried to spell commissioner and you’ll think, “How many m’s have typed? Did I type 2 or 3 commission in there? Did I get the –ion or you know…your eyes get kind of blurry.”
Rick: And in fact, we might even get rid of title here. We might just say long and then parentheses… I mean in the thing like that. There’s no… if we only have one thing that we’re using as our reference here… that is, if we’re only using naming convention, we don’t actually have to give that attribute its own name. So we would have long and then 1924 Welch or whatever, short 1924 Welch. And that makes entering your shortcode simpler, quicker.
Reese: It’ll always be… right.
Rick: Okay. And then in terms of our standard WordPress elements, short name is post title. Full case content is post content. Full reference is post meta. Link yes or no is post meta and name convention is post meta. So next time, what we’re going to do is create the custom post type and create the post meta for this. And then start writing the code that will… because what this code will do is when… the first thing the code is going to do is it’s going to sort through the posts to find the naming convention.
Reese: Correct. To find the 19… no, which is a post meta, right?
Rick: Right. And then based on… once it finds a post with that post meta, it will either give the long citation or the short citation. And it will either give a link or not a link.
Reese: Correct.
Rick: So we’ve actually spent more time talking about the concept than we’re going to spend actually doing the work to cycle through this stuff.
Reese: Okay, so I can go ahead and start using that… now is there any reason why it couldn’t be naming convention than long or short? Or does the long short have to go before naming convention?
Rick: Yeah, the long short has to go before naming convention. And the long short is actually a function name.
Reese: Gotcha.
Rick: We’ll have a function down here called long.
Reese: Okay now to make sure that nobody else has a long function, everybody else has a short function, should I use some kind of abbreviation like gti?
Rick: Well actually, the function itself, the function name will be different. This is a shorthand for the function. This is the function’s handle so when you define a shortcode, you create the handle for the function name. So the chances are, nobody else is using long as the… you certainly run the risk of sombody else using long as a shortcode. But since you’re pretty much in control of the site, the chances aren’t that great that that will happen.
Reese: Yeah. But my name also (20.19) and I’m not the luckiest guy on the block because the luckiest guy on the block won a bunch of money to World Series Poker.
Rick: Well so if you wanted to…
Reese: And you and I would be retired drinking little fizzy drinks with pink umbrellas on them.
Rick: That would be good. So if you wanted to, you can always make the shortcode this, right? You can make it gti short or gti long.
Reese: That’s actually… does that mean I need to put the naming convention inside the parentheses since that’s a parameter of the function?
Rick: Yeah, it still has to be inside of a single quotation mark.
Reese: Single quotation mark?
Rick: Yeah. But we’ll talk about that when we talk about writing the code.
Reese: Okay, well what I was trying to do is I’ve got about 30 of these things I’m trying to get uploaded here. And I was wondering if there’s some part of this I could go ahead and start working on.
Rick: Well…
Reese: But sounds like I need to wait until next time.
Rick: What I want you to do is I want you to give me 5 of these where I have the…
Reese: I think I’ve got it on my posts.
Rick: I want the full case content. I want what you want as its short name. I want what you want as its full reference. I want whether or not you want to link to it. We’ll assume you’re going to link to it and I want what your naming convention would be. I want you to spoonfeed that to me easily in 5… give me 5 of them. I’m going to load them on to the site and I’m going to use that as the test as we work our way through this next time.
Reese: Okay. And then when’s the next available time?
Rick: Next Wednesday.
Reese: Okay alright. Same bat time, same bat channel.
Rick: Absolutely.
Reese: Well Rick, thank you very much. I think we’ve made wonderful progress on understanding what we’re really trying to accomplish.
Rick: Well, the thing that I love about this little problem is that it extends the… it uses the power of WordPress as a content management system.