protected function setup_page_templates() {
		if ( ! is_array( $this->template ) || ! $this->has_post_type( papi_get_post_type() ) ) {
			return;
		}

		$this->show_page_template = true;
		foreach ( $this->post_type as $post_type ) {
			// Can't use `theme_templates` filter since it's added in 4.9.6.
			add_filter( "theme_{$post_type}_templates", function( $templates ) {
				foreach ( $this->template as $template ) {
					if ( ! is_array( $template ) || ! isset( $template['template'], $template['label'] ) ) {
						continue;
					}

					$templates[$template['template']] = $template['label'];
				}

				return $templates;
			} );
		}
	}
protected function setup_page_templates() {
		if ( ! is_array( $this->template ) || ! $this->has_post_type( papi_get_post_type() ) ) {
			return;
		}

		$this->show_page_template = true;
		foreach ( $this->post_type as $post_type ) {
			// Can't use `theme_templates` filter since it's added in 4.9.6.
			add_filter( "theme_{$post_type}_templates", function( $templates ) {
				foreach ( $this->template as $template ) {
					if ( ! is_array( $template ) || ! isset( $template['template'], $template['label'] ) ) {
						continue;
					}

					$templates[$template['template']] = $template['label'];
				}

				return $templates;
			} );
		}
	}
protected function setup_page_templates ( ) { if ( ! is_array ( $ this -> template ) || ! $ this -> has_post_type ( papi_get_post_type ( ) ) ) { return ; } $ this -> show_page_template = true ; foreach ( $ this -> post_type as $ post_type ) { // Can't use `theme_templates` filter since it's added in 4.9.6. add_filter ( "theme_{$post_type}_templates" , function ( $ templates ) { foreach ( $ this -> template as $ template ) { if ( ! is_array ( $ template ) || ! isset ( $ template [ 'template' ] , $ template [ 'label' ] ) ) { continue ; } $ templates [ $ template [ 'template' ] ] = $ template [ 'label' ] ; } return $ templates ; } ) ; } }
Setup page templates if templates is a array.
Setup page templates if templates is a array .