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

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

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

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems