-
WordPress does this by itself as one of the widgets created. Just add the categories widget to a sidebar or wherever you want and presto, job done!
-
If you need a more customized solution you’ll need to do a bit of coding.
what you want though is wp_list_categories() function.
<ul>
<?php wp_list_categories( array(
'orderby' => 'name',
'show_count' => true, //adds count of posts per category
'include' => array( 10 ) //only includes category with ID 10
) ); ?>
</ul>
see this link for reference: https://developer.wordpress.org/reference/functions/wp_list_categories/
Related Posts:
- Get the name an the description of a link category
- How to get category URL with the slug?
- Linking products to categories
- force category base – archive pages work WITH & WITHOUT category base slug in url?
- How do I get rid of “category” from my URL structure?
- Place category Base URL at the end
- How to display post type and category links in foreach WordPress code
- Why is it so hard to show the URL of the current category and how to do it?
- Latest updated categories list query, exclude one from displaying
- Anchor tag generates blank href attribute using echo esc_url( )
- wp_insert_link not working
- separate posts to have (kind of) 2 blogs?
- How can I display a list of categories of my posts
- can I ‘combine’ categories as a menu item?
- Show parent category wp_list_categories wordpress
- Showing the category hierarchy as clicked in WordPress, with image and desc
- Linking to the most recent post in my podcast category
- echo $category[0]-> cat_name; shows only one category name
- Custom EndPoint not working when strip child category in URL
- How would I get a taxonomy/category list inside a Gutenberg block?
- Gutenberg editor add a custom category as wrapper for custom blocks
- Rewrite rule page url with category
- WP_Query not looking at child category
- Deleting default category in wordpress
- Excluding posts from a category but only if they’re not in multiple categories
- Most recent post from every category/taxonomy but sorted by date
- Showing all the posts in one page?
- How to order categories in Woocommerce that are spread over multiple pages? [closed]
- Script to duplicate categories as tags
- Check if post belongs to any category
- How to sort categories by id in wordpress admin
- How to override Category rendering mechanism
- Can paginate_links() be customized for a specific category or tag?
- How to set up Author archives with sub category URL
- How to change number of items on add new pluggins page from backend?
- Do I have to use categories?
- get_the_category and echo out link to child-most/deepest category
- Categorising posts/pages into years published
- How can I duplicate categories and tags?
- Display category description instead of “nothing found” page
- Subcategories with the same name
- Link Attachment Image to Category
- Removing post category base giving Error 404
- posts_nav_link(); picks up index.php instead of category.php as template
- Category name field strips HTML tags. How can I reverse this?
- Check IF category_description exists
- How to show a list of only categories (exclude subcategories)
- How to list categories in reverse alphabetical order?
- I want to show category name when using [category] shortcode
- Category list with postcount
- What Must to Display the “mysite.com/category” URL?
- How to choose the content from a post which is in the right category?
- How to display product with two condition, category and brand taxonomy
- How to get category id’s which are added in main menu?
- Category List and Automatic jQuery classes
- How to add a custom thumbnail size for a specific category?
- get all categories’ latest post in one query
- Categories show 404 error on multisite installation
- Show posts from category specified using a custom field
- Custom menu with categories and tags
- excude a specidic category from showing in the “relative posts”
- Show posts from a single category by default using wordpress.com
- Filtering blog posts by category
- Get Categories of multiple posts
- Show subcategories broken when WP/WC updates
- How to change category labels in different colors?
- Display some WordPress categories as random order
- Correct Hook/Filter to amend category choices on post edit page
- omit categories from main navigation menu
- How to test if the post is in a primary category
- How to get the term id inside the start lvl method of category walker?
- Most efficient way to display current post subcategories?
- How to display the past events in one of the category?
- How to Query the Top 5 Posts of a specific category?
- How to add a post with new Taxonomy without assigning to default category?
- Page Type with Category Link
- Using wp_list_pages to create 2 lists of pages and include and exclude some of them depending on their category
- How to create default categories in new installs?
- If I change the taxonomy of a post will it get a new time stamp?
- Check if value is a custom taxonomy category name
- Tracking multiple tags or categories
- 2 loops in archive.php (one for each category)
- How to load jquery tag-it plugin into admin?
- not empty categories don’t show in menu [closed]
- How do I add and display a custom image field to a category? [duplicate]
- Show parent-child relationship for categories in the wordpress admin
- Print the associated categories of the current post starting with parent (with option to remove href)
- Add category image before post title on homepage
- Remove “?category=” in the URL wordpress ajax filter work for category
- Categories are not showing up according to the hierarchy
- Remove “All categories” from searchbar dropdown
- Get categories by title descendant
- Hide categories from authors
- Update/change category of a post when it’s been inactive for a certain number of days
- category_count gives wrong number of posts in category
- Sort Category Archive pages and place sticky posts first
- Add custom fields to Woocommerce Category Page
- wordpress category rewrite rule with pagination
- Can’t create tags or categories
- How to make /category/ URL load properly instead of 404 error?