Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

class GWP_Post_Series update1

main class for the plugin a part of GWP tutorial : https://generatewp.com/group-post-series-custom-taxonomy

/*
* GWP_Post_Series
*/
class GWP_Post_Series{
	/*
	 * $tax_name 
	 * used to avoid writing post series
	 * taxonomy name over and over.
	 * @var string
	 */
	public $tax_name = 'GWP_post_series';	
	/*
	 * __construct 
	 * Class constructor
	 */
	function __construct(){}

	/*
	 * hooks
	 * Used to hook all our functions
	 * @return void
	 */
	function hooks(){
		add_action( 'init', array( $this, 'register_post_series_taxonomy') );
	}

	/*
	 * register_post_series_taxonomy
	 * this will be greated using our Taxonomy generator
	 * @return void
	 */
	function register_post_series_taxonomy() {

		$labels = array(
			'name'                       => _x( 'Post Series', 'Taxonomy General Name', 'GWP_simple_post_series' ),
			'singular_name'              => _x( 'Post Series', 'Taxonomy Singular Name', 'GWP_simple_post_series' ),
			'menu_name'                  => __( 'Post Series', 'GWP_simple_post_series' ),
			'all_items'                  => __( 'All Post Series', 'GWP_simple_post_series' ),
			'parent_item'                => __( 'Parent Post Series', 'GWP_simple_post_series' ),
			'parent_item_colon'          => __( 'Parent Post Series:', 'GWP_simple_post_series' ),
			'new_item_name'              => __( 'New Post Series Name', 'GWP_simple_post_series' ),
			'add_new_item'               => __( 'Add New Post Series', 'GWP_simple_post_series' ),
			'edit_item'                  => __( 'Edit Post Series', 'GWP_simple_post_series' ),
			'update_item'                => __( 'Update Post Series', 'GWP_simple_post_series' ),
			'view_item'                  => __( 'View Post Series', 'GWP_simple_post_series' ),
			'separate_items_with_commas' => __( 'Separate Post Series with commas', 'GWP_simple_post_series' ),
			'add_or_remove_items'        => __( 'Add or remove Post Series', 'GWP_simple_post_series' ),
			'choose_from_most_used'      => __( 'Choose from the most used', 'GWP_simple_post_series' ),
			'popular_items'              => __( 'Popular Post Series', 'GWP_simple_post_series' ),
			'search_items'               => __( 'Search Post Series', 'GWP_simple_post_series' ),
			'not_found'                  => __( 'Not Found', 'GWP_simple_post_series' ),
			'no_terms'                   => __( 'No Post Series', 'GWP_simple_post_series' ),
			'items_list'                 => __( 'Post Series list', 'GWP_simple_post_series' ),
			'items_list_navigation'      => __( 'Post Series list navigation', 'GWP_simple_post_series' ),
		);
		$rewrite = array(
			'slug'                       => 'series',
			'with_front'                 => true,
			'hierarchical'               => false,
		);
		$args = array(
			'labels'                     => $labels,
			'hierarchical'               => false,
			'public'                     => true,
			'show_ui'                    => true,
			'show_admin_column'          => true,
			'show_in_nav_menus'          => true,
			'show_tagcloud'              => false,
			'rewrite'                    => $rewrite,
		);
		register_taxonomy( 'GWP_post_series', array( 'post' ), $args );
	}

	/*
	 * the_content
	 * Used to add the post series box to the single post view
	 * @param  string $content post content
	 * @return string 
	 */
	function the_content( $content = null ){}

	/*
	 * has_post_series 
	 * used to determine if a post is a part of a post series
	 * @param  int  $post_id  post ID
	 * @return boolean        true if the post is a part of a post series
	 */
	function has_post_series( $post_id ){}

	/*
	 * get_posts_in_series
	 * Get post ids of posts in a series by series ID 
	 * @param  int $series_id series term ID
	 * @return array|boolean  array of post IDs or false if none found 
	 */
	function get_posts_in_series( $series_id ){}

	/*
	 * get_post_series
	 * Get post series term object by post ID
	 * @param  int $post_id post ID
	 * @return WP_Term|boolean  series term object if found or false if not.
	 */
	function get_post_series( $post_id ){}

	/*
	 * create_post_series_box
	 * Create post series box html markup
	 * @param  int 		$current_id      	current post ID.
	 * @param  array 	$posts_in_series 	array of post IDs.
	 * @param  WP_Term 	$series          	Post Series taxonomy term.
	 * @return string 						HTML markup of post series box
	 */
	function create_post_series_box( $current_id, $posts_in_series, $series ){} 
}