Build Your Own Business Website header image

Community Library Website – Part 37, Add WordPress Menus to Archive Pages

Difficulty Level -

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.

Community Library Website – Case Study Part 1 – Site Organization
Community Library Website – Case Study Part 2 – Create Custom Post Types
Community Library Website – Case Study Part 3 – Custom Post Type Configuration
Community Library Website – Case Study Part 4 – Custom Taxonomy Decisions – Theory
Community Library Website – Case Study Part 5 – Custom Taxonomy Decisions – Practical Application
Community Library Website – Case Study Part 6 – Incorporating Existing Data Into the Project
Community Library Website – Case Study Part 7 – Creating Hierarchical Custom Taxonomies
Community Library Website – Case Study Part 8 – Creating Non-Hierarchical Custom Taxonomies
Community Library Website – Case Study Part 9 – Creating Custom Post Meta
Community Library Website Case Study – Part 10a – Restore the Database Using BackupBuddy
Community Library Website Case Study- Part 10 – Creating Custom Post Meta – Continued
Community Library Website – Part 11 – Importing Existing Data to the Website
Community Library Website – Part 12 – Prepare Existing Data for import by the CSV Importer plugin
Community Library Website – Part 13 – Import Existing Data Using the CSV Importer Plugin
Community Library Website – Case Study Part 14 – Date in Permalink Configuration
Community Library Website – Part 15 – Importing Images
Community Library Website – Part 16b – Final Data Import
Community Library Website – Part 17 – Add Thesis Post Meta to Custom Post Type
Community Library Website – Part 18 – Add WordPress 3.0 Menus
Community Library Website – Part 19 – Add Post Meta and Taxonomy Information to the Post Display
Community Library – Part 20 – Add topics and audience to book display
Community Library – Part 21 – Display the Rest of the Post Meta in the Post
Community Library Website – Part 22, Create the Permalink Structure
Community Library – Part 23 – Remove Custom Post Meta from Post Display
Community Library Website – Part 24, Add Taxonomy and Post Meta Data to the Teaser
Community Library Website – Part 25, Add Taxonomy Data to the Teaser
Community Library Website – Part 26, Adjust the Teaser Styling Using Design Options
Community Library Website – Part 27, Styling the Teaser Using CSS
Community Library Website – Part 28 – Fine Tune the Teaser Display
Community Library Website – Part 29, Designing a Custom Catalog Page
Community Library Website – Part 30, Using a Query String in a URL
Community Library Website – Part 31, Adding Custom WordPress Menus
Community Library Website – Part 32, Add Custom Menus to the Catalog Page
Community Library Website – Part 33, Add Another Custom Menu to the Catalog Page
Community Library Website – Part 34, Troubleshooting Custom Menus
Community Library Website – Part 35, Add Styling to WordPress Menus
Community Library Website – Part 36, Add HTML Markup to WordPress Menus
Community Library Website – Part 37, Add WordPress Menus to Archive Pages
Community Library Website – Part 38, Add and Style a List of Tags
Community Library Website – Part 39, Add a Search Box to the Sidebar
Community Library Website – Part 40, Add Links to the Sidebar
Community Library Website – Part 41, Add Taxonomy Drill Down Browsing
Community Library Website – Part 42, Custom Loop to Display Custom Post Types
Community Library Website – Part 43, Simple Custom Query
Community Library Website – Part 44, Custom Taxonomy Query
Community Library Website – Part 45, Add Thesis HTML Structure to Teasers
Community Library Website – Part 46, Display Posts from the Last 60 Days
Community Library Website – Part 47, Custom Loop If Have Posts
Community Library Case Study – Part 48, Increase the Number of Posts that Display on the Custom Catalog
Community Library Website – Part 49 – Naming Conflicts in Custom Taxonomies
Community Library Website – Part 50 – Find and Replace Semi-colons in the Database
Community Library Website – Part 51 – Modify Taxonomy Names Directly in the Database
Community Library Website – Part 52 – Sort Posts by Meta Value
Community Library Website – Part 53 – Show the Term Label Only when a Term Exists
Community Library Website – Part 54 – Sort Archive Posts by Meta Value
Community Library Website – Part 55 – Add Sort Order to Custom Taxonomy

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