What is the current behavior?
Mixed behavior: For some results it ignores search.blade.php and loads the first post (I am also utilizing custom post types, in addition to the standard post types). For other results, it lists results on a page as expected.
What is the expected or desired behavior?
Load search.blade.php and display a list of results.
Please provide steps to reproduce, including full log output:
Please describe your local environment:
Sage version: 9.0.0-beta.4
WordPress version: 4.9
OS: macOS High Sierra 10.13.2 Beta
PHP: 7.1.1
NPM/Node version: 5.5.1/6.10.2
Where did the bug happen? Development or remote servers?
Both development and remote servers
Is there a related Discourse thread or were any utilized (please link them)?
No
Resolved. Issue was on my end. When adding a custom post type I had added a filter on template_include, which would use a single custom template for a group of types. Since these custom post types are queried on search, I had forgot to add !is_search() on the boolean check for post types:
/**
* Handle template inclusion of single program so we use the right file.
*/
add_filter('template_include', function ($template) {
$types = ['undergrad_pt', 'grad_pt', 'cert_pt', 'hybrid_pt', 'exec_pt'];
$post_type = get_post_type();
if (in_array($post_type, $types) && !is_search()) {
return locate_template(['single-program.blade.php']);
}
return $template;
});
Most helpful comment
Resolved. Issue was on my end. When adding a custom post type I had added a filter on
template_include, which would use a single custom template for a group of types. Since these custom post types are queried on search, I had forgot to add!is_search()on the boolean check for post types: