1111 $ args = array ();
1212}
1313
14- $ is_front_page = isset ( $ args ['is_front_page ' ] ) && ( true === $ args ['is_front_page ' ] );
15- $ active_page = isset ( $ args ['active_page ' ] ) ? $ args ['active_page ' ] : '' ;
16-
17-
14+ $ is_front_page = isset ( $ args ['is_front_page ' ] ) && ( true === $ args ['is_front_page ' ] );
15+ $ is_404_page = isset ( $ args ['is_404_page ' ] ) && ( true === $ args ['is_404_page ' ] );
16+ $ active_page = isset ( $ args ['active_page ' ] ) ? $ args ['active_page ' ] : '' ;
17+ $ should_show_search_card = ( $ is_front_page || $ is_404_page ) && 'forums ' !== $ active_page ;
18+ $ should_show_search_navigation = ! $ is_front_page && ! $ is_404_page ;
1819
1920if ( ! function_exists ( 'get_support_search_link_for_query ' ) ) {
2021 function get_support_search_link_for_query ( $ query ) {
@@ -30,7 +31,7 @@ function get_support_search_link_for_query( $query ) {
3031}
3132
3233?>
33- <div class="happy-blocks-search-card<?php echo $ is_front_page && ' forums ' !== $ active_page ? '' : ' navigation-only ' ; ?> ">
34+ <div class="happy-blocks-search-card<?php echo $ should_show_search_card ? '' : ' navigation-only ' ; ?> ">
3435 <nav class="navigation-header">
3536 <!-- Desktop navigation -->
3637 <div class="desktop-nav-container">
@@ -44,7 +45,7 @@ function get_support_search_link_for_query( $query ) {
4445 </ul>
4546
4647 <!-- Search button -->
47- <?php if ( ! $ is_front_page ) : ?>
48+ <?php if ( $ should_show_search_navigation ) : ?>
4849 <div class="happy-blocks_navigation_search">
4950 <a class="jetpack-search-filter__link" href="#">
5051 <svg xmlns="http://www.w3.org/2000/svg" class="search-icon" width="24" height="24" viewBox="0 0 24 24" fill="#1E1E1E">
@@ -98,7 +99,7 @@ function get_support_search_link_for_query( $query ) {
9899 </div>
99100
100101 <!-- Search button -->
101- <?php if ( ! $ is_front_page ) : ?>
102+ <?php if ( ! $ should_show_search_navigation ) : ?>
102103 <div class="happy-blocks_navigation_search">
103104 <a class="jetpack-search-filter__link" href="#">
104105 <svg xmlns="http://www.w3.org/2000/svg" class="search-icon" width="24" height="24" viewBox="0 0 24 24" fill="#1E1E1E">
@@ -109,9 +110,19 @@ function get_support_search_link_for_query( $query ) {
109110 <?php endif ; ?>
110111 </div>
111112 </nav>
112- <?php if ( $ is_front_page && 'forums ' !== $ active_page ) : ?>
113- <div class="support-search-content">
114- <h2><?php echo esc_html ( __ ( 'How can we help you? ' , 'happy-blocks ' ) ); ?> </h2>
113+ <?php if ( $ should_show_search_card ) : ?>
114+ <?php
115+ $ content_classes = array_filter (
116+ array (
117+ 'support-search-content ' ,
118+ $ is_front_page ? 'is-front-page ' : '' ,
119+ $ is_404_page ? 'is-404-page ' : '' ,
120+ )
121+ );
122+ ?>
123+ <div class="<?php echo esc_attr ( implode ( ' ' , $ content_classes ) ); ?> ">
124+ <h2><?php echo esc_html ( $ is_404_page ? __ ( "This page doesn't exist " , 'happy-blocks ' ) : __ ( 'How can we help you? ' , 'happy-blocks ' ) ); ?> </h2>
125+ <?php echo $ is_404_page ? '<p class="subheading"> ' . esc_html ( __ ( "Let's help you find what you're looking for. " , 'happy-blocks ' ) ) . '</p> ' : '' ; ?>
115126 <form id="support-search-form" class="" role="search" method="get" action="">
116127 <div class="input-wrapper" dir="auto">
117128 <input id="support-search-input" type="search" name="s" placeholder="<?php echo esc_html ( __ ( 'Search questions, guides, courses ' , 'happy-blocks ' ) ); ?> "/>
0 commit comments