Skip to content

Snippet: Enable Post Series For Custom Post Type

/**
 * Register series for post types
 * This function register the taxonomy so you can now start using it, however it won't
 * display the actual post series on the front-end, for that you need to use some extra code,
 * we recommend adding a new blog for your post type via the theme filters (see useful links below)
 * and in your custom blog you can use the code get_template_part( 'partials/blog/blog-single-series' )
 * or you can copy and paste the code from the file at Total/partials/blog/blog-single-series into your new
 * block for your post type so you can also modify it accordingly.
 *
 * @link http://totalwptheme.com/docs/snippets/add-new-portfolio-single-blocks/
 * @link http://totalwptheme.com/docs/snippets/cpt-single-blocks/
 * @link https://codex.wordpress.org/Function_Reference/register_taxonomy_for_object_type
 *
 */
function myprefix_register_tax_for_objects() {
	register_taxonomy_for_object_type( 'post_series', 'portfolio' );
}
add_action( 'init', 'myprefix_register_tax_for_objects' );
All PHP snippets should be added via child theme's functions.php file or via a plugin.
We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top