最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

themes - Basic wordpress search shows no results

programmeradmin2浏览0评论

I have one of those "wtf" problems again. I can't figure why my search form shows no result. See this webpage: /?lang=en

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">
</form>

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.

Thanks!

发布评论

评论列表(0)

  1. 暂无评论