Notice: Undefined index: asalah_page_excerpt in /var/www/u6007393/public_html/webspidersolution.com/wp-content/themes/writing/functions.php on line 468

Notice: Undefined index: asalah_page_excerpt in /var/www/u6007393/public_html/webspidersolution.com/wp-content/themes/writing/functions.php on line 468

How to Create a Page Based on a Category on WordPress

wordpress tips beginnersOver 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).

theme locationWhen 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.

wp menu

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 .

Building Category Pages Using a Plugin

Recently, I got an email from a friend of mine with a WordPress issue that he was looking for some help with. He was converting his site from good ol’ HTML and CSS to WordPress and had run into an issue with how and where his posts were being displayed. He has three primary categories he writes under and wanted them all to be on separate pages. So, the first thing I did was explain to him that you can make category pages (just like I explained above.) Quickly, he realized that while it was close to the solution he wanted, it didn’t do one major thing: exclude posts from being displayed on his main page. After a little more back and forth, we landed on his requirements: three pages of categories with no “main blog page” where everything was posted.

Armed with these requirements, off I went in search of a solution. And in his case , the solution was right there in front of us.My friend had purchased a theme framework that included the ability to include and exclude categories on a per page basis, so with a couple of tweaks we had his site doing exactly as he visioned his site would be. Nice and easy.

But what happens if you have a framework that doesn’t have that built in? Should you abandon all hope? Or change boats mid-stream and buy this particular framework? Of course not. Why? ‘Cause there’s a plugin for that, of course!

Introducing-Simply Exclude

A search of the plugin repository for “category exclude” brings up a number of options including what has quickly shown itself to be a very good option, Simply Exclude, a plugin that does exactly as it advertises. Installing the plugin allows you to exclude items from being displayed in areas of your site as determined by you. For example, on one of my development sites, I decided to run the plugin through it’s paces and see how easy it is to exclude specific categories from the front blog page of the site.

By simply checking the box that matched how I wanted the configuration to look, I was able to very easily remove a category from showing up on my front page and yet have it all show up (as it normally would) on the category page. All I did was check that I wanted to exclude the category ’News’ from the front page, save my changes, and the plugin did the rest.

manage category

Simply Exclude also offers you the ability to exclude more than just categories. You can also configure the plugin to exclude by tag or author as well. All in all, this is a solid option to managing what categories get shown where.

Site Footer