How to display subcategories on the category page of WordPress
Do 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

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

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

Undress AI Tool
Undress images for free

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











Exchanges that support cross-chain transactions: 1. Binance, 2. Uniswap, 3. SushiSwap, 4. Curve Finance, 5. Thorchain, 6. 1inch Exchange, 7. DLN Trade, these platforms support multi-chain asset transactions through various technologies.

The exchange with the lowest handling fee in the currency circle is Binance, with a spot trading rate of 0.1%. 1. Binance: The spot transaction fee rate is 0.1%, and BNB deduction fee is supported. 2. OKX: The spot transaction fee rate is 0.02%-0.15%, suitable for high-frequency trading. 3. Gate.io: The spot transaction fee rate is 0.2%, and the coin is listed quickly.

An investor with a $170 million portfolio considers ShibaInu (SHIB) and MutuumFinance (MUTM) to be key assets in building generational wealth. ShibaInu benefits from growing interest in meme coins, while MutuumFinance is an emerging structured lending project with rapid pre-sales progress. Let's dive into the dynamics of these two crypto assets this week. ShibaInu: Long-term holders dominate ShibaInu's price fell 11% this week, but its long-term growth rate is as high as 123%, and the current trading price is $0.0001139. Technical analysts point out that the cryptocurrency is on the rebound trend line and is

Sesame Open Door is a platform that focuses on cryptocurrency trading. Users can obtain portals through official websites or social media to ensure that the authenticity of SSL certificates and website content is verified during access.

The top 10 foreign mainstream currency exchanges include: 1. Binance, the world's largest, with leading trading volume and number of users; 2. Coinbase and Kraken, suitable for European and American users, compliant and safe; 3. OKX and Huobi, more popular in the Asian market; 4. Bybit, providing high-leverage contracts, suitable for derivative trading; 5. KuCoin and Gate.io, launching new products quickly, supporting niche currencies.

Choose a reliable trading platform such as OKEx to ensure access to the official entrance.

2025 Ancoin Exchange Registration Tutorial: Prepare your email and password, visit the official website to register, complete KYC verification, set 2FA and trading password to recharge and start trading.

The recommended cryptocurrency trading platforms in 2025 include: 1. OKX, which ranks first with its technical strength and global operations; 2. Binance, which leads in the number of users and transaction volume; 3. Gate.io, which has a rich currency and low transaction fees; 4. Huobi Global, which has a stable user base; 5. Kraken, which is known for its security and compliance; 6. Coinbase, which focuses on compliance; 7. KuCoin, which has strong innovation and community interaction; 8. Crypto.com, which has a strong brand influence; 9. Bitfinex, which is the first choice for professional traders; 10. MEXC Global, which has fast transaction speed and low fees.
