Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now that our portfolio site has both static pages, a blog, and three custom post types, we need to add links to each of them in our menu. This is easy enough with the static pages and the Home and Blog page. But to get the custom post type index pages to appear, we have to put in the URLs manually. As you can see, by default, as we add new pages in they appear in the menu, but we want to create a custom menu for our site so that we can control it. By the way, if you're following along using the exercise files and you skipped the first movie from this chapter, you need to jump back and actually complete the first movie, because in this chapter each movie depends on the previous one.
So jump back, complete movie number one, and then come back here. Since we haven't done anything to the menu yet, we're now seeing the default menu and the default menu is populated by a Home button and then a button for each of the static pages. What we need to do is create a custom menu so we can slot in the menu items we want in the order we want and with the text we want. So I'll go to WordPress Admin, go down to Appearance, and here I'll find Menus. Here I can create a new menu. So I'll call it Header Menu and then I'll assign my new header menu to as the Primary Menu, and now I can add items to my Header Menu.
First, I'll add the static pages. So I'll go View All. I'll add the Home page, the About page, the Blog page, and the Contact page. Click Add Menu and they are all added to my menu. Now, I can change the names of them, so I'll change this Welcome to Culinary Artistry. I'll cut that out and put it in as a title instead and I'll name this Home. I'll go to About and add a Title Attribute, About Culinary Artistry. I'll go to the Blog and add a Title Attribute.
The Culinary Artistry Blog. And at the bottom I'll add an attribute to Contact. It's very important that you add these title attributes, not only because it makes it more understandable for search engines, but also because when people visit the site using a non-visual browser, they'll have an easier time understanding what your menus are for. I'll click Save now just to test that my menu works.
I'll go back to the front page and reload it and you see we now have Home, About, Blog, and Contact and as I hover over them, you also see that those title attributes appear. Now, I need to add the links to the recipes index, the photos index, and the videos index. If you remember, the URL for these links was simply recipes, photos, and videos. So what I need to do is add this link in so that when you click on a button you get directed there.
So what I'm going to do is copy the link from here and then just paste it in. And then I have to give it a label. The label in this case is Recipes, and I'll click Add to Menu. Now, the link to the Recipes is added to the bottom of my menu and I can simply move it up, and then I can go in and change Title Attribute, and then I can add a link to photos, call it Photos, and also add a link to videos and call it Videos.
And like with recipes, I'll pull them up and then add Title Attributes to them. When I'm done, I click Save Menu, go back, and reload the Home page and now we have links to Home, Recipes, Photos, Videos, the About page, the Blog, and Contact.
If I click on Recipes, Photos, or Videos, I'm taken directly to the index pages for each of them. If you want to know more about how to use custom menus in WordPress and also how to add more custom menus to your theme, you should check out both the WordPress 3 Essential Training course on lynda. com and the WordPress 3: Building Child Themes course, both of which covered this topic extensively. With the menu that points to all the static pages as well as the custom post type index pages, and the blog page, we're now nearly done with our portfolio site.
Get unlimited access to all courses for just $25/month.Become a member
117 Video lessons · 43129 Viewers
119 Video lessons · 54405 Viewers
65 Video lessons · 14624 Viewers
113 Video lessons · 82945 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.