Created
November 9, 2019 22:58
-
-
Save eksiscloud/56b57d66e0f0ed9dd3c6657513eef008 to your computer and use it in GitHub Desktop.
Seriously Simple Podcasting: Use categories of Wordpress
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
// 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