Created
February 14, 2013 05:10
-
-
Save wpsmith/4950715 to your computer and use it in GitHub Desktop.
Remove Genesis Breadcrumbs Conditionally
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you for share this.