3) берем весь html код меню в обертку .wrap и дописываем немного кода $(document).mouseup(function (e) { var container = $(".wrap"); if (container.has(e.target).length === 0){ toggleNav(); } });
<?php
/**
* The template for displaying search results pages.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package tsumugi
*/
get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title">
<?php if ( pll_current_language() == 'ru' ) : ?>
<?php printf( esc_html__( 'Результаты поиска по запросу: %s', 'tsumugi' ), '<span>' . get_search_query() . '</span>' ); ?>
<?php endif; ?>
<?php if ( pll_current_language() == 'en' ) : ?>
<?php printf( esc_html__( 'Search Results for: %s', 'tsumugi' ), '<span>' . get_search_query() . '</span>' ); ?>
<?php endif; ?></h1>
</header><!-- .page-header -->
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
/**
* Run the loop for the search to output the results.
* If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead.
*/
get_template_part( 'template-parts/content', 'search' );
endwhile;
the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif; ?>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_sidebar();
get_footer();
<?php
/**
* Template part for displaying a message that posts cannot be found.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package tsumugi
*/
?>
<section class="no-results not-found">
<header class="page-header">
<h1 class="page-title">
<?php if ( pll_current_language() == 'ru' ) : ?>
<?php esc_html_e( 'Ничего не найдено', 'tsumugi' ); ?>
<?php endif; ?>
<?php if ( pll_current_language() == 'en' ) : ?>
<?php esc_html_e( 'Nothing Found', 'tsumugi' ); ?>
<?php endif; ?></h1>
</header><!-- .page-header -->
<div class="page-content">
<?php
if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
<p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'tsumugi' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
<?php elseif ( is_search() ) : ?>
<p>
<?php if ( pll_current_language() == 'ru' ) : ?>
<?php esc_html_e( 'По Вашему запросу ничего не найдено. Попробуйте по-другому сформулировать свой запрос:', 'tsumugi' ); ?>
<?php endif; ?>
<?php if ( pll_current_language() == 'en' ) : ?>
<?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'tsumugi' ); ?>
<?php endif; ?></p>
<?php
get_search_form();
else : ?>
<p>
<?php if ( pll_current_language() == 'ru' ) : ?>
<?php esc_html_e( 'Попробуйте воспользоваться поиском:', 'tsumugi' ); ?>
<?php endif; ?>
<?php if ( pll_current_language() == 'en' ) : ?>
<?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'tsumugi' ); ?>
<?php endif; ?></p>
<?php
get_search_form();
endif; ?>
</div><!-- .page-content -->
</section><!-- .no-results -->
<?php
/**
* The template for displaying search results pages.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package tsumugi
*/
get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title">
<?php if ( pll_current_language() == 'ru' ) : ?>
<?php printf( esc_html__( 'Результаты поиска по запросу: %s', 'tsumugi' ), '<span>' . get_search_query() . '</span>' ); ?>
<?php endif; ?>
<?php if ( pll_current_language() == 'en' ) : ?>
<?php printf( esc_html__( 'Search Results for: %s', 'tsumugi' ), '<span>' . get_search_query() . '</span>' ); ?>
<?php endif; ?></h1>
</header><!-- .page-header -->
<?php
/* Start the Loop */
while ( have_posts() ) : the_post();
/**
* Run the loop for the search to output the results.
* If you want to overload this in a child theme then include a file
* called content-search.php and that will be used instead.
*/
get_template_part( 'template-parts/content', 'search' );
endwhile;
the_posts_navigation();
else :
get_template_part( 'template-parts/content', 'none' );
endif; ?>
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_sidebar();
get_footer();
<?php
/**
* Template part for displaying a message that posts cannot be found.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package tsumugi
*/
?>
<section class="no-results not-found">
<header class="page-header">
<h1 class="page-title">
<?php if ( pll_current_language() == 'ru' ) : ?>
<?php esc_html_e( 'Ничего не найдено', 'tsumugi' ); ?>
<?php endif; ?>
<?php if ( pll_current_language() == 'en' ) : ?>
<?php esc_html_e( 'Nothing Found', 'tsumugi' ); ?>
<?php endif; ?></h1>
</header><!-- .page-header -->
<div class="page-content">
<?php
if ( is_home() && current_user_can( 'publish_posts' ) ) : ?>
<p><?php printf( wp_kses( __( 'Ready to publish your first post? <a href="%1$s">Get started here</a>.', 'tsumugi' ), array( 'a' => array( 'href' => array() ) ) ), esc_url( admin_url( 'post-new.php' ) ) ); ?></p>
<?php elseif ( is_search() ) : ?>
<p>
<?php if ( pll_current_language() == 'ru' ) : ?>
<?php esc_html_e( 'По Вашему запросу ничего не найдено. Попробуйте по-другому сформулировать свой запрос:', 'tsumugi' ); ?>
<?php endif; ?>
<?php if ( pll_current_language() == 'en' ) : ?>
<?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'tsumugi' ); ?>
<?php endif; ?></p>
<?php
get_search_form();
else : ?>
<p>
<?php if ( pll_current_language() == 'ru' ) : ?>
<?php esc_html_e( 'Попробуйте воспользоваться поиском:', 'tsumugi' ); ?>
<?php endif; ?>
<?php if ( pll_current_language() == 'en' ) : ?>
<?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'tsumugi' ); ?>
<?php endif; ?></p>
<?php
get_search_form();
endif; ?>
</div><!-- .page-content -->
</section><!-- .no-results -->