Over the weekend, I was fortunate enough to speak at WordCamp Victoria, where, during my session, I fielded a series of questions from audience members about categories. While I already have a post on categories available, one of the questions I fielded was from an individual looking to make pages out of post categories–something not addressed in that article. He seemed genuinely surprised to hear that he could make simple pages from categories by using the menu function built into WordPress, so I promised him a post on how to do it. This is that post. And later this week, I will also show you a more advanced method involving some code that will help you segregate the content and not have it show up in duplicate spots on your site.
The Easy Method
The easiest way to create a page based on a single category is to do it through the menu section in your WordPress Dashboard. After you have created your category (from the dashboard go to Posts> Categories then fill out the Add New Category section; or you can simply add a new category in the Add New Post window), head on over to the Menus section under Appearance.
The first thing you’ll need to do when you are in the Menu section is to check in the left hand corner of the page to see if your particular theme supports menus (most themes do these days, but there are some that don’t so it’s best to check).
When you are sure your theme supports custom menus, the next step is to actually create the menu. In the centre of the page you will see a large section where you can create your menu. Start by giving your menu a name (it doesn’t matter what you call it as long as you know what the name is when you are ready to include it in your site). Make sure you click the ‘Create Menu’ button to actually create the menu.
Congratulations, you’ve just created your first menu! It’s empty right now, but we will fix that in a moment.
Adding Category Pages to the Menu
Now that you have a menu created, you need to put some links in that bad boy. (…or bad girl, depending on your preference there). As you look down the left hand side of the menu page, you’ll see a few different options for adding links to your menu. The first one I want you to take note of is the Custom Link box. I use this one on just about every site I build for the obligatory ‘Home’ link on the nav bar. It’s easy to create as all you need to do is enter the URL or domain name of your website in the field marked ‘URL’, then just give it a friendly name in the ‘Label’ Field (something like Home, Main, etc.). Then click the button labelled ‘Add to Menu,’ and–voila!–you have a menu item.
At this point,you have done most of the heavy lifting when it comes to creating the menu, and all that’s left is to populate the menu with the items you want.
As you look down the left hand side of the Menu page you’ll see boxes for Pages and Categories. Since adding Categories and Pages to a menu is the same, I’ll use the Categories as the example I work through. The default view here is to show the Most Used categories, but you may want to include some categories that aren’t visible there, so click on the link labelled ‘View All’ and you will see all the categories you have created. Simply check the box beside all the categories you want displayed in your menu and then click the ‘Add to Menu’ button, and next thing you know, they are all listed in your menu! You can now grab the gray box for each menu item and arrange them in the order you like. You can also create sub menu items by clicking on the gray box and dragging it under the item you want as the parent and then moving the box slightly to the right. WordPress automatically recognizes that motion as your desire to place the item as a child to the parent menu item above it. You can add as many sub menu items as you like, even creating sub menu items for sub menu items (Be careful here; you need to keep your site visitor in mind and make sure they are going to be able to find your content easily. Just because it makes sense to you, doesn’t mean it may make sense to your visitor. So build your menu with care.)
And there you have it, you’ve now created a menu using the categories for your posts. When you click on the menu item, all you will see on that page are the posts that you have given that specific category to.
Now for the bad news: your posts are going to show up in two places–on your main posts page and on your category specific page. Now that may not bother you too much (or at all, for that matter), but if it does, I’ll show you in a future article how to make sure those posts only show up in a single place on your website .