Build Your Own Business Website header image

Community Library Website Case Study – Part 37, Add WordPress Menus to 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 thirty seventh in a series of live lessons on using WordPress and Thesis as a Content Management System (CMS). In this lesson we continue working on the menus in our new catalog page. We add the menus to the archive pages by creating a new function in custom_functions.php. The menus now appear above the content on the archive pages.

Video Transcript

Rick: We have added the menus, we’ve styled the menus. Now what we need to do is add the menus to things like fiction. Now you will notice actually that I’ve already got something here and that was because I played around a bit today to try to get you know, how I would make this work on these other pages.

And so we’re going to take a look at that now in custom function php. And essentially, what we need to do you know, my first thought was that we take the adult menu here and say if is page 200 or if it’s a category archive page then just show this post. The problem with that was that we were hooking it to the Thesis hook after post box and archive pages just don’t have that hook so it didn’t show up. So we have to in fact, have 2 different functions, a function for pages and a function for archive pages.

So what we’re going to do then is essentially, we’re going to copy this stuff we put in here. We’re going to come down to… so what I did here was… that’s what I did. Now, I hooked it before content and created a new function, byob adult menu archive. And so, I’m just going to replace the old content with the label, with the title. And then what we’re going to do is we’ll take this one more time, copy that and put that below the children’s one. Okay and now this is going to add the adult menu to the… add the children’s menu and then let’s see, let’s just do that search and replace thing here. Adult for children’s, replace all… okay. Since I have this selected, it just replaces in the selection. It doesn’t replace say the adult you know, up here. And so that search and replace is nice and handy for making minor changes like that. We’re essentially doing the same thing except you just want it to reference something slightly different. Oh look at that though. This has to be children’s. I had it match case and since it matched of course, it passed on that one. Save the document, upload the document and then let’s go to adult fiction, see what happens.

Okay so now in this case, what we’ve done is we’ve taken this menu and we put it ahead of the name of this archive. That’s probably appropriate. Now we might want to add some additional padding in here and we could probably make this whole thing look nice just by getting rid of these silly borders. In fact, let’s just do that right now. But… oh, it does say adults. Look at that. The heading here is wrong and the reason it is again is because I did that search and replace with the… where it matched the case so it didn’t change adults there.

So let’s go back to our code and change that to children. Okay, that’ll work and so, upload it. Let’s go to the dashboard and let’s get rid of these borders. Design Options and then I think it’s in show into your layout borders and fonts, colors and more. We’ll save that, come back over here. Go to custom catalog, get adult fiction and yeah, we probably want to add some padding to this to make it you know, drop down a little bit more but that looks pretty good.

So Pam, I’m going to turn your microphone on here. Okay Pam, are you with us?

Pam: Yes I am.

Rick: Any comments on this?

Pam: I think it looks terrific. Once again, you’ve done even beyond what I had imagined. I’m looking forward to eventually…we’ll get some kind of a banner going across you know, fiction, biography and so on just to see what you did and continue to the events website. Definitely it’s a different one but this is looking fabulous. I’m really pleased.

Rick: Okay, well I think it’s pleased of it too. I think it’s… I mean, this is a very good way for people to try and you know, navigate their way around the collection and it’s definitely better than this, I think. It’s better than having the drop down. And so, it’s a great idea and it gave us an opportunity to practice styling the WordPress menus and try a couple of new things so…

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