src/Routes.php
private function get_blog_routes() {
		$data = [];

		$blog_url = false;

		$home_url = home_url();

		$page_on_front = get_option( 'page_on_front' );

		$blog_page = get_option( 'page_for_posts' );

		if ( ! $page_on_front ) {
			$blog_url = '/';
		} elseif ( $blog_page ) {
			$blog_url = rtrim( str_replace( $home_url, '', get_permalink( $blog_page ) ), '/' );
		}

		if ( $blog_url ) {
			$data[] = [
				'state' => 'blogIndex',
				'url' => $blog_url,
				'template' => 'blog',
				'endpoint' => $this->get_wp_endpoint_route( 'posts' ),
				'params' => apply_filters( self::FILTER_BLOG_PARAMS, [] ),
			];
		}

		// Create routes for single blog posts if active.
		$single_post_url = apply_filters( self::FILTER_SINGLE_POST_ROUTE, '/' === $blog_url ? '/blog' : $blog_url );

		if ( $single_post_url ) {
			$data[] = [
				'state' => 'blogPost',
				'url' => $single_post_url . '/:slug',
				'template' => 'blog-single',
				'endpoint' => $this->get_wp_endpoint_route( 'posts' ),
			];
		}

		return $data;
	}
private function get_blog_routes() {
		$data = [];

		$blog_url = false;

		$home_url = home_url();

		$page_on_front = get_option( 'page_on_front' );

		$blog_page = get_option( 'page_for_posts' );

		if ( ! $page_on_front ) {
			$blog_url = '/';
		} elseif ( $blog_page ) {
			$blog_url = rtrim( str_replace( $home_url, '', get_permalink( $blog_page ) ), '/' );
		}

		if ( $blog_url ) {
			$data[] = [
				'state' => 'blogIndex',
				'url' => $blog_url,
				'template' => 'blog',
				'endpoint' => $this->get_wp_endpoint_route( 'posts' ),
				'params' => apply_filters( self::FILTER_BLOG_PARAMS, [] ),
			];
		}

		// Create routes for single blog posts if active.
		$single_post_url = apply_filters( self::FILTER_SINGLE_POST_ROUTE, '/' === $blog_url ? '/blog' : $blog_url );

		if ( $single_post_url ) {
			$data[] = [
				'state' => 'blogPost',
				'url' => $single_post_url . '/:slug',
				'template' => 'blog-single',
				'endpoint' => $this->get_wp_endpoint_route( 'posts' ),
			];
		}

		return $data;
	}
private function get_blog_routes ( ) { $ data = [ ] ; $ blog_url = false ; $ home_url = home_url ( ) ; $ page_on_front = get_option ( 'page_on_front' ) ; $ blog_page = get_option ( 'page_for_posts' ) ; if ( ! $ page_on_front ) { $ blog_url = '/' ; } elseif ( $ blog_page ) { $ blog_url = rtrim ( str_replace ( $ home_url , '' , get_permalink ( $ blog_page ) ) , '/' ) ; } if ( $ blog_url ) { $ data [ ] = [ 'state' => 'blogIndex' , 'url' => $ blog_url , 'template' => 'blog' , 'endpoint' => $ this -> get_wp_endpoint_route ( 'posts' ) , 'params' => apply_filters ( self :: FILTER_BLOG_PARAMS , [ ] ) , ] ; } // Create routes for single blog posts if active. $ single_post_url = apply_filters ( self :: FILTER_SINGLE_POST_ROUTE , '/' === $ blog_url ? '/blog' : $ blog_url ) ; if ( $ single_post_url ) { $ data [ ] = [ 'state' => 'blogPost' , 'url' => $ single_post_url . '/:slug' , 'template' => 'blog-single' , 'endpoint' => $ this -> get_wp_endpoint_route ( 'posts' ) , ] ; } return $ data ; }
Create routes for the blog page and single posts if active..

@return array
Create routes for the blog page and single posts if active ..