Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

the_content filter

part of GWP tutorial : https://generatewp.com/group-post-series-custom-taxonomy

	/*
	 * 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 ){
		global $post;
		//bail out if not single post or no post series was found
		if ( ! is_single() && ! $this->has_post_series( $post->id ) ){
			return $content;
		}

		//get post series taxonomy term
		$series = $this->get_post_series( $post->ID );
		//if no series was found return the content
		if ( false == $series || ! isset( $series->term_id ) ){
			return $content;
		}

		//get posts in series
		$posts_in_series = $this->get_posts_in_series( $series->term_id );
		//if no posts were found in series return the content
		if ( false == $posts_in_series ){
			return $content;
		}

		//get post series box
		$series_box = $this->create_post_series_box( $post->ID, $posts_in_series, $series );

		//return the content with the post series on top (filterable)
		return apply_filters( 'GWP_series_content', $series_box.$content, $content, $series_box, $series, $posts_in_series, $post );
	}