How to display subcategories on the category page of WordPress
Apr 20, 2025 am 07:18 AMDo you want to display subcategories on the category page of WordPress?
WordPress makes it easy for you to organize your posts using categories and subcategories. You can help visitors navigate subcategories more easily by displaying them on the category page.
In this article, we will show you how to display subcategories on the category page of WordPress.
Why do subcategories appear on category page?
When you write posts for your WordPress website, you can optimize your search engines and improve your website navigation by correctly categorizing your content. This will bring more traffic to your website and make it easier for visitors to find what they are looking for.
On some websites, it makes sense to use subcategories to simplify the structure of a website.
For example, you might have a top (parent) category called "Sports". You can then create subcategories under Sports called NFL, NBA, and MLB.
When your visitors click on the Sports category, they will see each post in the Sports category and its subcategory. However, they won't see a list of subcategories. This makes it hard to filter to NFL or NBA posts.
Showing a list of subcategories on the category page can improve site navigation. This is especially true if you decide to hide subcategories in the Category Widget of your website.
For example, visitors to your website can easily transfer from all sports posts to NFL-only. Even better, you can continue to display the same subcategories on the NFL page so that they can easily switch from NFL to NBA.
That being said, let's see how to display subcategories on the category page of WordPress.
How to display subcategories on the category page of WordPress
To display subcategories on the category archive page, you need to add the code to the topic file. If you need help adding code to your website, see our beginner's guide on how to paste web snippets into WordPress.
The first thing you need to do is go into the theme folder and look for a name called category.php.
If you don't see the file, you have to create it. Just copy archive.php and name it category.php.
Note : If your theme does not contain category.php or archive.php, you may be using the WordPress theme framework and you must create category.php manually. A great starting point for learning how to create archive files is our guide on how to create custom archive pages in WordPress.
Now, just add the following code before the category.php loop:
Now when you visit the category page, you will see a list of subcategories.
On our demo website, the Sports Categories page displays links to the NFL, NBA, and MLB subcategories.
After clicking the NFL link, you will be on the NFL subcategory page.
Here you can still see links to the sports subcategories, so you can easily switch between different types of sports. This can really simplify navigation on your website.
We hope this tutorial helps you learn how to display subcategories on the category page of WordPress. You may also want to learn how to improve your website's SEO or our expert picks of the best WordPress popup plugins.
The above is the detailed content of How to display subcategories on the category page of WordPress. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

?In today's increasingly popular digital asset trading, it is particularly important to understand how to safely and effectively withdraw your digital assets. As a world-renowned digital asset trading platform, ok exchange provides convenient currency withdrawal services. This tutorial will analyze in detail the steps of withdrawing coins on the ok exchange, things to note, and some common questions and answers to help users complete asset transfer smoothly and ensure asset security. Whether you are using ok exchange for withdrawals for the first time or want to further understand the withdrawal process, this article will provide you with clear and practical guidance.

As an important digital asset hard forked from the original Ethereum blockchain, Ethereum Classic (ETC) has always been the focus of market attention. After experiencing ups and downs in early development and multiple technological iterations, ETC still occupies a place in the global cryptocurrency market with its unique decentralized spirit and smart contract platform functions. There are many factors that affect ETC prices, including but not limited to macro trends in the entire cryptocurrency market, ETC’s own network upgrades and security, community activity, changes in regulatory environments, and the attitudes of institutional investors.

The latest version of Digital Currency Exchange 2025 is a world-leading digital asset trading application, committed to providing users with secure, stable and convenient trading services for mainstream digital currencies such as Bitcoin and Ethereum. Its simple and intuitive operation interface and powerful functional modules make it easy for both novices and senior traders to get started.

Ethereum, as one of the blockchain platforms with leading market value and the most active ecosystem, has attracted much attention. It is not only a digital asset, but also the cornerstone of innovation fields such as decentralized applications, smart contracts, decentralized finance (DeFi) and non-fungible tokens (NFT). Predicting its future price trend is a complex process, affected by the interweaving of multiple factors such as technological development, macroeconomic environment, regulatory policies, market sentiment and network itself upgrade.

Dogecoin (DOGE), a digital asset originating from the Internet subculture, has occupied a place in the crypto market with its unique community culture and wide popularity. For many market participants, predicting their price movements over a specific time period in the future is challenging but attractive. This article aims to deeply analyze the key factors that may affect Dogecoin’s market value from 2025 to 2030 and explore its potential development path.

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

The latest version of Binance is v2.102.5, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.

The latest version of Binance is 2.101.8, and the update tutorial is: 1. Click the download link in the web page; 2. Authorize the installation permission of "Allow installation from unknown sources"; 3. Find the downloaded APk and click to install; 4. Click the installed application to open it.
