#119419
 BajaPablo
Participant

Abe and Radu, Success! I found some code for the Sweet Date theme search.php template that directs you back to the site when you click on the search button with no content in the field. Rather than having all those internal pages revealed… I think you may want to include this in your next update, with my blessings.

You will find the code here, replace the DOT with a period when you search for this page… THE CODE IS THERE, MAGIC!

https://wordpressDOTorg/support/topic/stop-showing-all-pages-when-no-content-in-search-box

Here is the code below you will paste into the Sweet Date theme search.php template – attached NO RESULTS FOUND jpg is the result when you click on the blog search button as a non-registered non-member visitor and an illustration of my blog search content-none.php template page which I found out is a loop to another wordpress template in another theme, its difficult to figure out how to change the text on that page… test it out, visit my blog page and click on search next to the search field… thanks again for your patience and help!

http://bajaretireddate.com/wordpress/blog/

The magic Sweet Date theme search.php template code…

<?php
/**
* The template for displaying search results pages
*
* @package WordPress
* @subpackage Twenty_Sixteen
* @since Twenty Sixteen 1.0
*/

get_header(); ?>

<?php if ( have_posts() && strlen( trim(get_search_query()) ) != 0 ) : ?>

<?php while ( have_posts() ) : the_post(); ?>

<?php if ( has_post_thumbnail() ) : ?>

<a
class=”thumbnail”
title=”<?php the_title_attribute(); ?>”
href=”<?php the_permalink(); ?>”
>
<?php the_post_thumbnail( ‘medium’ ); ?>

<!–/.span3 –>

<?php else : ?>

<!– /.row-fluid –>
<hr />
<?php endwhile; ?>
<?php else : ?>

<?php endif ;?>

<!–/.span8 –>

<!–/.row –>

<!–/.container –>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Log in with your credentials

Forgot your details?