Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Last active July 27, 2017 18:59
Show Gist options
  • Save JiveDig/4f5eea314c9581bd5ed3231e942298a4 to your computer and use it in GitHub Desktop.
Save JiveDig/4f5eea314c9581bd5ed3231e942298a4 to your computer and use it in GitHub Desktop.
Add adjacent post navigation to posts in a specific category, by ID.
<?php
// Remove adjacent post nav.
add_action( 'after_setup_theme', function(){
remove_post_type_support( 'post', 'genesis-adjacent-entry-nav' );
});
/**
* Add adjacent post navigation to posts
* in a specific category, by ID.
*/
add_action( 'wp_head', function() {
// Bail if not a single post.
if ( ! is_singular( 'post' ) ) {
return;
}
// Bail if not in category with ID of 123
if ( ! has_term( 123, 'category' ) ) {
return;
}
// Add adjacent post nav.
add_post_type_support( 'post', 'genesis-adjacent-entry-nav' );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment