Skip to content

Instantly share code, notes, and snippets.

@itsjusteileen
Last active July 23, 2019 21:01
Show Gist options
  • Save itsjusteileen/a0280e04ecf85fd46556038c166f13a8 to your computer and use it in GitHub Desktop.
Save itsjusteileen/a0280e04ecf85fd46556038c166f13a8 to your computer and use it in GitHub Desktop.
Add category support to Seriously Simple Podcasting Plugin
<?php
/*
Add categories support to the SSP plugin. Include this code in a blank customizations plugin for your site. If you already have a plugin, do not add the php opening tag in line one, only add code beginning at line 6.
*/
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->is_category() ) {
$query->set( 'post_type', array( 'post', 'podcast' ) );
}
}
add_action( 'init', 'ssp_add_categories_to_podcast', 12 );
function ssp_add_categories_to_podcast() {
register_taxonomy_for_object_type( 'category', 'podcast' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment