Basic wordpress search shows no results


I have one of those “wtf” problems again. I can’t figure why my search form shows no result. See this webpage:

There is get_search_form() in the header. I also created searchform.php:

 <div class="search">
  <div class="search-field">
<form role="search" method="get" id="searchform" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    <input type="search" value="<?php echo get_search_query(); ?>" placeholder="" name="s" id="s" class="search-input search-item" >
    <input type="submit" value="" class="search-button search-item">

And search.php:

    <section id="primary" class="content-area">
        <div id="content" class="site-content" role="main">

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

            <header class="page-header">
                <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'shape' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
            </header><!-- .page-header -->

            <?php shape_content_nav( 'nav-above' ); ?>

            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>

                <?php get_template_part( 'content', 'search' ); ?>

            <?php endwhile; ?>

            <?php shape_content_nav( 'nav-below' ); ?>

        <?php else : ?>

            <?php get_template_part( 'no-results', 'search' ); ?>

        <?php endif; ?>

        </div><!-- #content .site-content -->
    </section><!-- #primary .content-area -->

The searchpage is opened after clicking on the search button but there are no result. Maybe is there any problem with database or anything? Do you have any ideas?

I also noticed that there is difference between searching actual content of the websites. For example if you type “About us”, it will show the search.php but no results on it. On the other hand if you type “Big truck” or “fsdgwdhs”, it will send back other page than search.php. So I think that wordpress maybe know that there are some results but it does not show them. I do not know.


, Hynek Kaplan 2 years 2019-12-29T05:28:21-05:00 0 Answers 94 views 0

Leave an answer