Skip to content

Commit

Permalink
Templates: Use archive template for search results
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle committed May 20, 2024
1 parent a71e714 commit 6cbc967
Showing 1 changed file with 2 additions and 1 deletion .
3 changes: 2 additions & 1 deletion source/wp-content/themes/wporg-themes-2024/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
add_filter ( ' post_thumbnail_html ' , __NAMESPACE__ . ' \post_thumbnail_html ' , ten , five );
add_action ( ' body_class ' , __NAMESPACE__ . ' \add_extra_body_class ' );
add_filter ( ' frontpage_template_hierarchy ' , __NAMESPACE__ . ' \use_archive_template_paged ' );
add_filter ( ' search_template_hierarchy ' , __NAMESPACE__ . ' \use_archive_template_paged ' );
add_action ( ' single_template_hierarchy ' , __NAMESPACE__ . ' \load_theme_preview ' );
add_filter ( ' query_loop_block_query_vars ' , __NAMESPACE__ . ' \modify_query_loop_block_query_vars ' , ten , two );
add_filter ( ' post_type_link ' , __NAMESPACE__ . ' \update_theme_shop_permalink ' , ten , two );
Expand Down Expand Up @@ -199,7 +200,7 @@ function use_archive_template_paged( $templates ) {
global $ wp_query ;
$ current_browse = $ wp_query -> query [ ' browse ' ] ?? false ;

if ( is_paged () || $ current_browse ) {
if ( is_paged () || $ current_browse || is_search () ) {
array_unshift ( $ templates , ' archive.html ' );
}

Expand Down

0 comments on commit 6cbc967

Please sign in to comment.