Template_Override::set_search_template_path( string[] $templates )

Summary

No summary available.

Parameters

$templates

(string[]) (Required)


Return

(string[])


Source

File: src/BigCommerce/Templates/Template_Override.php

	public function set_search_template_path( $templates ) {
		if ( ! is_search() ) {
			return $templates;
		}

		$post_type = get_query_var( 'post_type' );
		if ( $post_type !== Product::NAME ) {
			return $templates;
		}

		// strip out search.php and index.php to force post-type-specific template
		$templates = array_filter( $templates, function ( $path ) {
			return ! in_array( $path, [ 'search.php', 'index.php' ] );
		} );

		$prefixed = $this->prefix_theme_paths( $templates );

		return array_merge( $prefixed, $templates );
	}

User Contributed Notes

You must log in before being able to contribute a note or feedback.