Skip to content

Instantly share code, notes, and snippets.

@eksiscloud
Created November 9, 2019 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eksiscloud/56b57d66e0f0ed9dd3c6657513eef008 to your computer and use it in GitHub Desktop.
Save eksiscloud/56b57d66e0f0ed9dd3c6657513eef008 to your computer and use it in GitHub Desktop.
Seriously Simple Podcasting: Use categories of Wordpress
// Podcast to wp-category
add_action( 'init', 'ssp_add_categories_to_podcast' );
function ssp_add_categories_to_podcast () {
register_taxonomy_for_object_type( 'category', 'podcast' );
}
add_action( 'pre_get_posts', 'ssp_add_podcast_to_category_archives' );
function ssp_add_podcast_to_category_archives( $query ){
if( is_admin() ) {
return;
}
if( $query->is_tax('category') ) {
$query->set('post_type', array( 'post', 'podcast' ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment