How to Display a Category Page in WordPress

Using categories and tags is the best way to organize your website so visitors can navigate it easily. Categories effectively group your content and create a logical site structure, which helps to provide visitors with a great reading experience. Let’s start by looking at what a category page is, and then how you can use them to improve UX on your website.

First: What are Category Pages in WordPress?

Simply put, a category page lists all posts assigned to a single category or multiple categories. This page helps site owners group posts with similar topics together, making it easier for visitors to locate related content.

There are two main reasons why you should take full advantage of category pages:

  1. To improve your website’s SEO: Your category archive pages function as landing pages when readers search for topic-related keywords or phrases. By driving naturally targeted traffic to your site, these pages considerably boost your overall domain authority, leading to higher rankings in Google search results.
  2. To improve user experience: Category pages encourage visitors to read more posts in categories that interest them. They’re also useful for navigation to other content on your site. Additionally, by using Google Analytics to identify your most popular categories, you can focus your efforts on improving posts within those high-performing categories.

How to Improve SEO of Your Site & Overall User Experience with Category Pages

When optimizing category pages, you should consider the category itself, its slug, description, and subcategories. Since categories and their slugs play important roles in leveraging marketing opportunities, keep these points in mind:

  • Use clear, descriptive, and content-related category names, such as “Films” or “Music” instead of vague terms like “Other forms of entertainment.”
  • Cover a broad range of your blog posts with well-defined categories.

In addition to the categories themselves, category descriptions are significant features you should fully utilize. A good category description not only enhances user experience but also makes the category clearer and more informative.

Subcategories (also known as child categories) are narrower than their parent categories. For example, you might have a main category called “Business” that you divide into deeper subcategories such as “Sales” and “Marketing.”

Implementing and displaying subcategories helps your website’s SEO and provides better browsing experiences for visitors, who can easily navigate to different types of content.

How to Display Category Pages in WordPress

A category page can include posts from a single category or multiple categories. Follow this guide to display both types of category pages in WordPress.

#1 Display a Page Featuring Posts from a Single Category

Viewing Directly

When you create a category, WordPress automatically generates a page that includes posts from that category. To display that page:

  1. Go to Posts → Categories
  2. Navigate to Categories, then click “View” under your desired category
categories-wordpress
Screenshot

When you click “View,” a category page will appear, and you can get a direct link to this page.

However, you’ll notice the category base in your URLs, which can make it harder to achieve higher Google rankings. Fortunately in WordPress, there’s a simple way to remove the category base from your archive page links:

  1. Go to Settings → Permalinks
  2. Choose “Custom Structure”
  3. Add /%category%/%postname%/ after your domain
  4. Enter “.” in the “Category base” field
permalinks-category
Screenshot

Showing in Menu and Sidebar

There are two steps to show the category page in your menu and sidebar:

  1. Assign posts to categories: First, go to Posts and choose the post you want to add to a category. On the right, you’ll see Category options. Click on your desired category and update your changes.
  2. Display the category page in navigation menus and widgets: Remember: Before displaying categories in the menu, make sure these categories have posts filed under them.

In menus: Go to Appearance → Menus, select categories, and click “Add to Menu.

categorypage_menus

In the sidebar: Go to Appearance → Widgets, then choose the categories you want to appear in the sidebar and click “Add Widget.”

categorypage_widget

When you want to show subcategories in the sidebar, drag and drop categories to a Sidebar. Then check the box next to “Show hierarchy” in the categories widget’s settings and click “Save.”

#2 Display a Page Featuring Posts from Multiple Categories

Besides showing posts from a specific category, you might want to display posts from multiple categories on a single page. Installing the Advanced Custom Fields Pro (ACF Pro) plugin is an ideal option. After installing and activating ACF Pro:

  1. Go to Pages → Add New
  2. Enter a name for this page (it should be a broader name)
  3. Locate “Display Posts”
  4. Select your preferred categories and set the number of posts in each category
  5. Click “Add Row”
  1. categorypage_acp

How to Display Category Descriptions on Category Archive Pages

Category descriptions are usually automatically displayed on category archive pages. However, if your theme doesn’t support this feature, you’ll need to edit your theme files:

  1. Connect to your WordPress site using an FTP (File Transfer Protocol) client
  2. Go to the /wp-content/themes/your-current-theme/ folder
  3. Navigate to the category.php file and edit it. If your theme doesn’t have that file, edit the archive.php file instead
  4. Copy and paste the following code:
<?php the_archive_description('<div class="taxonomy-description">', '</div>'); ?>

How to Display Subcategories on Category Archive Pages

If a category has subcategories and you want to display a list of all sub or child categories on the parent archive page, copy and paste this code to your archive.php file:

<?php
// Check if we're on a category page
if (is_category()) {
    $this_category = get_category($cat);
}
?>

<?php
// Get category listing based on whether current category has a parent
if ($this_category->category_parent) {
    $this_category = wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of=' . $this_category->category_parent . "&echo=0");
} else {
    $this_category = wp_list_categories('orderby=id&depth=1&show_count=0&title_li=&use_desc_for_title=1&child_of=' . $this_category->cat_ID . "&echo=0");
}

// Only output the list if categories were found
if ($this_category) {
?>
<ul>
    <?php echo $this_category; ?>
</ul>
<?php
}
?>

Conclusion

Category pages are beneficial both for users who want to quickly find what they’re looking for, and for website owners who need to maintain a coherent site structure. For this reason, understanding what category pages are and how to display them in various ways is essential for every site owner.

As your blog content grows, make sure to organize your category pages properly by using them to improve your website’s SEO and improve your audience’s reading experience.