Build Your Own Business Website header image

Customize Next & Previous Posts Links – Part 8 – Change Post Navigation for Home and Archive Pages

Difficulty Level -

Filed Under Topics -

Listed Under Lesson Subjects -

Applies to -

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 8th in an 8 part series that shows how to customize the Next Post/Previous Post links in Thesis. All of the work we’ve done so far has been applied to single posts only. Now we are going to apply the same changes to the Home and Archives pages.

Video Transcript

Rick: So Jeb, are you still with us? Yeah, you look like you’re still with us. Okay so Jeb, I’m going to turn your microphone on. Jeb, do you have a microphone?

Jeb: I sure do.

Rick: Perfect. So did that make sense?

Jeb: It made perfect sense. You’re a master, a wizard.

Rick: That’s what you were trying to accomplish then.

Jeb: Yes, that’s about 80% of what I was trying to accomplish. The additional 2 items are a) I want to get this not just on a single post page but I guess on the blog page as well although correct me if I’m wrong, the way that I’m setting it up is the front page, which is the blog, is only going to have one featured post. There’s not going to be piece or anything, it’s just going to be one post and then previous, random… actually in that case, it’s just going to be previous and random image. So I want to make it appear there as well so I assume that’s going to be if is single… in addition to that if is… I don’t know if it will be home or front page.

Rick: Well, what you would do here is copy this, that was the function we just created, right? And instead of custom previous next post, we’re going to use custom post navigation. We’ll just use that so we can keep the 2 straight…V and then custom post navigation, copy that, come up here to custom post navigation and then instead of if is single, it’s if is home or if is archive. And the or symbol is this double straight line… or is and then underscore archive. And now, we’ve met all 3 of the conditions here, right? If is home, if is archive, if is single… this one catches to your homepage and every other archive page and this one catches your single posts and if we save that and upload it and refresh it… pardon me, I just didn’t refresh. I undid. And refresh it and then go to our blog page, in this case, it’s going to be down at the very bottom, right? But there it is on our homepage and it’s also going to be there on our archive pages so if we look at our Green Apples archive, it’s there. And if we look at our Red Apples archive, it’s there.

Jeb: Okay so that’s perfect. That’s exactly what I wanted and the final thing would be to place all 3 of those images with their corresponding links at the top of both of those as well be home, archives, as well as the …

Rick: Is that going to be above the title?

Jeb: Exactly, yes. If it’s just slightly different that is much easier then it’s fine too.

Rick: Well, it’s just hooking the function to another hook.

Jeb: Okay. What exactly is the position? Does that affect that though?

Rick: What’s that?

Jeb: Well, just thinking through that…

Rick: Oh yes, absolutely. You’re absolutely right. That will in fact, affect… yes, it will. You probably want to create… well, I guess what you do is you create another set of these.

Jeb: Did you have to do them all or would you just create a 2nd random function?

Rick: Yes, you’d create a 2nd random function. Right, I’m sorry, I’m totally… that’s exactly what you would do is create a 2nd random function and in this case you know, you might change byob
random to random top and then random bottom and then you could change your relative stuff that way.

Jeb: Okay so then it’s just a matter of adding… do another add action then and for all the other ones you know, for the previous and next, you just add it for post box top or whatever the right hook is.

Rick: Absolutely you know, Thesis hook before headline might be you know, or Thesis post box. Yeah, I think it’s actually probably Thesis hook before post or Thesis hook before headline. Something like that.

Jeb: Okay so that would be a 2nd… it’s just a 2nd line of add action under those long previous and next functions and then under the…

Rick: And then a 2nd for these too.

Jeb: Okay, yes.

Rick: You never completely… you’d have to complete another function for the top and for the bottom and they would have different hooks. But you’d have a separate add action for… you’d have another add action that would be just a different hook but exactly the same function for the post navigation and for the previous next post.

Jeb: Okay, that’s awesome. I don’t suppose you’d be willing to cut and paste all that code when it…

Rick: Oh no, absolutely. This code is going to be pasted in the forum here in a few minutes.

Jeb: Oh, good then.

Rick: It’ll be pasted under Live Answer code.

Jeb: Okay, awesome.

Rick: Okay?

Jeb: That is exactly what I needed, Rick. I really, really appreciate it.

Rick: Great.

0 Comments… add one
0 comments… add one

Leave a Comment