You can skip categories that have parent in your loop:
foreach($category_list as $category) {
if( '0' != $category->parent )
continue;
I’ve looked through the source, but it seems depth
is only taken in account in wp_list_categories()
and you will probably need to extend Walker_Category
class to custom walker there to make changes to output.
Actually, this might be a good idea if you need a really complex categories output format.
Related Posts:
- How to get current_cat in navbar, in single post
- How can I get posts in a subcategory to display on it’s parent categories archive page?
- Custom category order with get_categories
- Auto add taxonomy if post has category
- Show posts on a page based on a category and tag(s)
- Query posts by category AND custom field, then ORDERBY another custom field – help!
- How to add “Read More…” link in twentytwenty
- how to get the categories for a single product in a hierarchical way
- Automatically check parents (in a taxonomy) when child is selected
- Category selectable homepage
- How to change the category url jusy show /category/%category_id% in wordpress?
- How can I create a permalink with two categories, with the order based on the parent category?
- How do I list custom taxonomy terms with the links?
- Get whole linked with wp_list_pages
- Adding Multiple “Parents” in get_categories
- How to setup a membership system in WordPress?
- Make the home page template my archive/category page template without code duplication
- Get custom text if in Category
- Create Miltiple Category Base
- Is it possible to edit a wordpress category with Gutenberg?
- How to show related post with category DESC (ASC) IDs of ID current post
- Hide entry-header for a specific category
- How can I add category variable inside posts?
- Post thats in Two Categories, only want to display name for one
- woocommerce display product category on checkout page [closed]
- Prevent posts from being published if the ‘Uncategorized’-category or no category is selected
- Show last child Child category instead of first child category on page
- wordpress categories narrow down results
- Modifying posts based on category in TwentyTwentyTwo theme
- How to *remove* a parent theme page template from a child theme?
- How to disable page delete
- WordPress hook before inserting post into database
- How to update the delete user confirmation form?
- Widgets vs. Theme Mods
- In the new Theme Customizer API, how to send a value from the front back to the admin panel?
- How do I add Post Like and Bookmark Functionality to my WordPress Site?
- How to exclude certain widget from showing up on home/front page? [duplicate]
- Best way to pass arguments to another page in WordPress
- register_sidebar ‘after_widget’ on custom-built widgets not implementing, caused nested widgets
- Hide Login information in Account settings in Buddy Boss
- Custom Login and Registration form in Ajax
- Rebuild vs Upgrade – need pointers, advice
- Changing editor-style.css style
- Can I develop a WordPress site without a domain?
- How to extend customize control types to list pages
- Customize the WordPress Default Gallery Output
- How to get rid of from overbooking car rental website [closed]
- Programmatically (PHP) get the nr. of items in the primary navigation menu
- Multi Site installation inside a sub domain inside a sub directory
- How to create left and right menu with logo center in a custom theme?
- How can i limit the number of posts created per category?
- How can I setup a wordpress site with multi country & multi lingual support
- Filtering *out* a taxonomy from the admin post list
- 1 WordPress installation with 2 pages: every page gets a separate domain
- REQUIRED: Could not find wp_link_pages. See: wp_link_pages by Theme Checker
- problem in uploading attachment to custom directory
- How to stop displaying the Id without losing the functionality
- How to update theme from localhost to online site
- Is it necessary to use Timthumb in WordPress 2.9+?
- How to show wp.me shortlink underneath each post?
- Change admin avatar only (without Gravatar or plugin)?
- How do I change the element using a custom function?
- Is it necessary to prefix theme_mod, section id and panel id in the customizer?
- Query for specific custom field
- How can i create menu like in the example?
- Can readers download zip files from WordPress sites?
- Create a custom admin panel
- Translate custom template with WPML
- What are some good resources for teaching end-users how to use WordPress?
- How can I resolve a .htaccess internal server error setting up a WordPress multisite?
- Is it possible to add custom badges to product attributes conditionally, based on custom field?
- Product page not found if product data is set Appointment Service
- I want to embed mystream video in my wordpress site
- Current menu item highlights wrong
- Measure time in ONLY HOUR format
- How can error pages be customized
- Replace an URL with an new URL which has a “?” in it
- How can I make a category function as a page?
- Contact form 7 ajax response true/false based on some condtion
- Child Theme – Changing Header
- remove or hide Link Relationship (XFN) form Menus tab
- Custom post styling per category?
- How to add custom classes to a WordPress theme HTML tag?
- Displaying Child Page’s Information
- Changing ‘Add to cart’ button text and relink for some specific products [closed]
- adding a custom time class to in theme twenty sixteen
- ‘str_replace’ and ‘strtr’ not working inside plugin
- SAving PHP in custom wordpress option field
- Does WordPress support template resources/custom fields
- Change default “Apply Changes To” radio option when editing images
- Edit a custom admin page
- If I delete my wordpress site then does that delete all my sites?
- Remove Twenty Twelve themes responsiveness in Internet Explorer
- Looking for a way to take readers to random post when clicking a link
- Cannot upload to S3 using CDN Sync Tool
- Custom Import with taxonomies
- Very Simple Geo targeting
- Consolidate ‘add-to-cart’ buttons into one ‘add-all-to-cart’ button
- Update to WordPress 4.9.2, but have heavily customized theme
- Storing form data into wordpress database [closed]