Category Menu Items

| March 29, 2020

This is another general WordPress question that I see quite often: how can I create a menu item that displays a page of posts belonging to a particular category? For example, let’s say I have a site about animals, and I’ve created a category called Dogs and a category called Cats, and by clicking on a menu item labeled Dogs, I want to display a list of posts that have the Dogs category assigned to it.

The first thing to know is that you don’t have to create a separate page for your category. WordPress will use the same template that it uses to display your regular blog page: index.php (unless your theme has any one of a number of specialized templates). The only thing that you have to do (assuming that you’ve already created your categories, you’ve assigned those categories to your posts, and you’ve created a custom menu for your site) is to create a category menu item.

  1. Go to Appearance → Menus.
  2. On the left should be a section labeled Categories. If it is not there, then click the Screen Options tab in the upper right corner of your window and check the box labeled Categories. That section should then appear on the left side of the page.
  3. Expand the Categories section and you should see a list box showing all of your currently defined categories.
  4. Check the category that you want to add to your menu, then click the Add to Menu button.
  5. The new category menu item should now be in the right section labeled Menu Structure. Drag & drop the menu item to the place in the menu where you want the menu item to appear.
  6. If you want to change the text on the menu item, expand the menu item and change the Navigation Label field.
  7. Click the Save Menu button.

Your site will now have a new category menu item that, when clicked, will display a list of posts which have that category assigned.

If you don’t want to use the default index.php file to display your posts, you can create a child theme and make a copy of index.php into category-xxxx.php, where xxxx is your category slug.

Leave a Reply

Your email address will not be published. Required fields are marked *