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

Contents 1. What is ICN? 2. ICNT latest updates 3. Comparison and economic model between ICN and other DePIN projects and economic models 4. Conclusion of the next stage of the DePIN track At the end of May, ICN (ImpossibleCloudNetwork) @ICN_Protocol announced that it had received strategic investment in NGPCapital with a valuation of US$470 million. Many people's first reaction was: "Has Xiaomi invested in Web3?" Although this was not Lei Jun's direct move, the one who had bet on Xiaomi, Helium, and WorkFusion

As July 2025 approaches, the crypto market is hotly discussing which tokens may bring high returns. Are names like Pi, PEPE and FloppyPepe really worth the risky investment? Potential cryptocurrencies worth paying attention to in July 2025: virtual fire or real gold? As mid-2025, the heat of discussions on high-yield crypto assets continues to heat up. Bitcoin trends and "altcoin season" expectations have attracted investors' attention. Do tokens like PiNetwork, PEPE and FloppyPepe have the potential to bring considerable investment returns? Let's analyze its prospects one by one. Altcoin Market: Can July get what it wants? Against the backdrop of Bitcoin’s expected record of historical highs, the “altcoin season” seems to be brewing. Back

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.

Polkadot is causing heated discussion on the stage of DeFi and cross-chain integration! Let’s analyze its underlying technical structure, ecological construction progress, and the core driving force that helps DOT move towards its $5 price target. Polkadot, DeFi and Cross-chain: Observation from New York, Polkadot is setting off a new wave of craze in the DeFi and cross-chain fields. The crypto market is changing, but DOT is gradually emerging. Next we will explore the factors behind its rise. Interoperability: Polkadot's core competitiveness Polkadot's most significant advantage is its ability to connect and connect with different blockchains. You can compare it to being a universal world of blockchain

Meme currency market response strategy in July 2025: Analyze popular tokens such as BONK and NEIRO, and discuss investment returns and risks. The Meme currency market has always been known for its violent fluctuations, and the market in July 2025 is no exception. Tokens such as BONK and NEIRO have seen significant increases, with double-digit gains, attracting the attention of many investors. However, is this uptrend speculation or opportunity? Let’s analyze the logic and investment strategies behind it. Meme coin boom: What is the driving force behind price fluctuations? Meme coin price changes are usually affected by community popularity, social media dynamics, and speculation. A tweet, a popular emoticon, and even celebrity likes can cause drastic price fluctuations. This is a high wind

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.
