• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Remove Sub Categories From Genesis Loop Archives

The 1st code snippet in this tutorial enables you to modify the Genesis loop while maintaining the default markup used to display all archives. You can use this code to remove all posts from all subcategories. Posts in sub categories display on all archive types including any blog listings page, archive, author, blog, category, search, and tag pages by default.

The code removes posts assigned to all sub categories from all archive page types.

You can use any WP Query parameters with the code in this post.

Here’s an example showing posts from sub categories included in the home page loop in the 1st image:

include-sub-categories

And the 2nd image showing all posts from all subcategories removed:

no-sub-categories

Code Usage – Globally or Specific Archives

If you want the code to effect all archive type loops, add it to your child themes functions.php file.

If you only want the code to effect a specific archive, place the code in a archive.php, category.php or other type of archive file using the WordPress Template Hierarchy to name the file.

Also included in this post is a 2nd code snippet which removes all posts from all sub categories from displaying on all parent category archive pages.

Here’s the code for members:

Register for full access

Child / Sub Categories

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.