by NganNT
January 1, 2022

How to display a category page in WordPress

The WordPress category page permits you to easily sort content on your website. They also help visitors easily find content and are good for SEO. So, today, we are going to show you how to display a category page in WordPress with some easy steps.

Why you need to show category pages in WordPress?

The category page in WordPress enable you to list all posts that are assigned to one category or multiple categories. It means that this page support the admin to group posts with a similar topic together and help to locate content-related posts more convenient. There are some reasons why you should capture the full capabilities of category pages in WordPress:

Firstly, it help to improve the SEO of your WordPress website: Your category archive page will work as a landing page when users look for topic-related keywords or phrases. Since it helps driving organic targeted traffic to your online store, your overall domain authority is boosted significantly, leading to a higher ranking on Google SERPs.

Secondly, it help to improve the user experience: With the category page, you encourage users website to read more posts in the same category they are interested in. Also, it’s also helpful if they want to navigate to other posts on your website. Moreover, when using Google Analytics to identify which category achieve the most popularity, you can put more effort to enhance the posts on that category page.

How to display category pages in WordPress

Create a page featuring posts from a single category

When you generate a new category in WordPress, a page is automatically created that contain all the posts assigned to that category.

  • To see the direct link to the page of a single category, simply move to WordPress Dashboard > Posts > Categories.
  • When you hover your mouse over the category title, a list of options will display. You click on View to take the direct link to the single category page.
Wordpress category page
  • At this step, you can see the link which found in the address bar of your browser. You can copy this link and use in your menu bar as the direct link to that category.
Wordpress category page
  • To add the category link to your menu bar, simply move to Appearance > Menus and then choose or generate the menu you wish to add the category link to. Then click on Custom Links.
  • You paste in the category URL into the URL box and then title the link.
  • Next step, you click Add to Menu.
  • You can click on the related post link below for further instructions on setting up and adjust a menu.
Wordpress category page

Display a page featuring posts from multiple Categories

If you want to show posts on a page from multiple categories. You can install Advanced Custom Fields Pro (ACF Pro) plugin. After installing and activating ACF Pro, you can follow the step below to showcase the page:

  • Move to Pages → Add New
  • Enter the name of this page (It should be a broader name)
  • Locate Display Posts
  • Choose your favorite categories and set the number of posts in each category.
  • Click Add Row
Wordpress

Show category description in WordPress theme

If you are familiar with using code on your WordPress website, then you can use these code snippets to show category descriptions in other locations around your website

Show a Single Category Description on Your site

If you want to show a category description in other parts of your site, then you will need to apply the category_description template tag:

<?php echo category_description(3); ?>

You’ll need to replace 3 with the category ID of the category you need to use.

Show Category Descriptions in Each Post

  • If you want to show a category description inside single posts, then you can add a code snippet to, say, the single.php or footer.php template.
  • In case you’re using a child theme, then you need to first copy the template from the parent theme to the child theme folder.
  • Next step, you need to follow this code.
$catID = get_the_category();
echo category_description( $catID[0] );
  • This code simply have all categories for the current post and then outputs the category description of the first category.

Show All Categories and Descriptions

If you would like to showcase all your WordPress categories with a description in list format, then you can include this code in your theme’s functions.php file:

function wpb_catlist_desc() { 
$string = '<ul>';
$catlist = get_terms( 'category' );
if ( ! empty( $catlist ) ) {
  foreach ( $catlist as $key => $item ) {
    $string .= '<li>'. $item->name . '<br />';
    $string .= '<em>'. $item->description . '</em> </li>';
  }
}
$string .= '</ul>';
  
return $string; 
}
add_shortcode('wpb_categories', 'wpb_catlist_desc');

This code creates a shortcode which list all your categories and their descriptions in a plain list.

You can now use [wpb_categories] in your posts and pages. To apply this shortcode inside a text widget, you will need to enable shortcodes for widgets.

Wordpress

Wrapping up

Knowing what a category page is and how display a category page in WordPress is essential for every site owner. Arrowtheme hopes you will encounter no issues while display a category page in WordPress.

Besides, whether you are looking to build robust ecommerce websites, redesign existing websites, or seeking a professional maintenance & Support service, our WooCommerce Development Packages provide you with a team of experts who are ready to help you achieve your business goals. Especially, you can get up to 30% off for all of your WordPress services.

You can reach us at Here. We’ll be happy to provide you with a free consultation

0 comments

Related Posts