Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Created February 14, 2013 05:10
Show Gist options
  • Save wpsmith/4950715 to your computer and use it in GitHub Desktop.
Save wpsmith/4950715 to your computer and use it in GitHub Desktop.
Remove Genesis Breadcrumbs Conditionally
<?php
/**
* I used genesis_before, but you can also use get_header or other hooks as long
* as you call the check function prior to the breadcrumbs being called.
*/
add_action( 'genesis_before', 'wps_remove_genesis_breadcrumbs' );
/**
* Remove Genesis Breadcrumbs from all but 1 category.
*/
function wps_remove_genesis_breadcrumbs() {
/**
* I used category ID here, but you can use category slug or category name.
* e.g., is_category( this-is-a-slug )
* e.g., is_category( 'This is a Title' )
*/
if ( ! is_category( 5 ) ) // Change 5 to whatever category ID you want.
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
}
@mparraud
Copy link

thank you for share this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment