I currently have a sidebar with a search-form at the top. When the user types in a keyword, when submitted the user is took to a page with search results with posts relating to them words in each article.
At the moment, when a keyword is not found, they are sent to a page which shows the title 'nothing found' and a message saying 'Sorry nothing found, Please try again'.
What i would like is whatever page the user is on (Main page, Category page, single page and so forth) the user to stay on that page and just display at the top of the nav this title and information of 'no results found'.
Is this possible at all in some way? I am not the expert when it comes to Wordpress so apologies if the answer is simple and i have not sussed it out!
Thanks.
<?php get_header(); ?>
<?php if ( have_posts() ) : ?>
<?php get_template_part( 'nav', 'above' ); ?>
<h1 class="page-title">
<?php printf( __( 'Search Results for: %s', 'blankslate' ), '<span>' . get_search_query() . '</span>' ); ?>
</h1>
<?php while ( have_posts() ) : the_post() ?>
<?php get_template_part( 'entry' ); ?>
<?php get_sidebar(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'nav', 'above' ); ?>
<h1 class="page-title">
<?php _e( 'Nothing Found', 'blankslate' ) ?>
</h1>
<p><?php _e( 'Sorry, nothing matched your search. Please try again.', 'blankslate' ); ?></p>
<?php get_sidebar(); ?>
<?php get_template_part( 'nav', 'below' ); ?>
<?php get_footer(); ?>
<?php endif; ?>