Wordpress搜索结果页面返回404,但记录存在于数据库中

时间:2018-06-06 23:13:11

标签: wordpress custom-wordpress-pages

我有2个wordpress安装,1个用于主要内容,另一个是帮助中心。

帮助中心安装在主要内容目录中。所以你有wordpress目录,另一个在该目录中,因此我们可以使用不同的主题并改变两者之间的外观。

我只是好奇,在搜索结果页面上,我收到了正确的网址,但他们将会访问404页。我在数据库中验证了这些记录的存在,因此数据库没有制作这些记录并且这些页面不存在也不是问题。另一个注意事项是搜索结果页面将返回已创建的页面,但

<?php

get_header();
global $wp_query;
$total_result = $wp_query->found_posts;

?>

<div class="main">

  <div class="main-hero">

    <div class="container">

      <h1>Boxstorm Help Center</h1>
      <p>Search the Boxstorm Help Center documentation</p>

      <div class="search-wrapper">

            <form id="searchform" class="searchform" role="search" method="get" action="<?php echo site_url(); ?>">
              <div>
                <label class="screen-reader-text" for="s">Search for:</label>
                <input id="s" name="s" type="text" placeholder="<?php echo esc_attr_x( 'Search &hellip;', 'placeholder', 'boxstorm' ); ?>" value="<?php echo get_search_query(); ?>">
                <span class="search-button-wrapper">
                  <input id="searchsubmit" type="submit" value="">
                  <i class="fa fa-search"></i>
                </span>
              </div>
            </form>


      </div><!-- / .search-wrapper -->

    </div>

  </div><!-- /.main-hero -->

  <nav class="main-hero-subnav cd-secondary-nav">

    <div class="container">
      <div class="is-hidden-mobile">
        <?php get_breadcrumb(); ?>
      </div>
    </div>

  </nav>

  <div class="panel sub-nav-hero">

    <div class="container page">

      <div class="columns is-multiline is-mobile search-results">

        <div class="column is-3-desktop is-6-tablet is-full-mobile left">
          <div class="columns top-cats is-multiline is-mobile is-centered">

            <div class="column is-11-desktop is-10-tablet is-6-mobile">
              <div>
                <a href="<?php echo site_url(); ?>/getting-started/">
                  <i class="fas fa-list-ul"></i>
                  <h2>Getting Started</h2>
                </a>
              </div>
            </div>

            <div class="column is-11-desktop is-10-tablet is-6-mobile">
              <div>
                <a href="<?php echo site_url(); ?>/documentation/">
                  <i class="fas fa-book"></i>
                  <h2>Documentation</h2>
                </a>
              </div>
            </div>

            <div class="column is-11-desktop is-10-tablet is-6-mobile">
              <div>
                <a href="<?php echo site_url(); ?>/videos/">
                  <i class="far fa-play-circle"></i>
                  <h2>Browse Videos</h2>
                </a>
              </div>
            </div>

            <div class="column is-11-desktop is-10-tablet is-6-mobile">
              <div>
                <a href="<?php echo site_url(); ?>/contact/">
                  <i class="fas fa-at"></i>
                  <h2>Contact Support</h2>
                </a>
              </div>
            </div>

          </div>
        </div>

        <div class="column is-9-desktop is-6-tablet is-full-mobile right">
          <h1 class="results"><?php printf( __( 'Search results for: <b>%s</b>', 'boxstormsupport'), get_search_query() ); ?></h1>

            <div class="columns is-multiline">

              <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); get_template_part( 'content', 'search' ); ?>
              <div class="column is-12 results">
                <h2><?php the_title(); ?></h2>
                <p><?php the_excerpt(); ?></p>
                <a href="<?php the_permalink(); ?>" class="results-link"><?php the_permalink(); ?></a>
              </div>
              <?php endwhile; else : ?>
              <div class="column is-12">
                <p><?php _e( '<p>Sorry, but there were no results for the term <b style="font-weight:900;">'.get_search_query().'</b>. Please refine your search terms and try again.</p>' ); ?></p>
              </div>
              <?php endif; ?>
            </div><!-- / columns -->

        </div><!-- / columns is-9 right -->

      </div><!-- / search-results -->
    </div>

  </div>

</div>

<?php get_footer(); ?>

该网站正在https://www.boxstorm.com/help-center上线。如果你想看到问题。

这些页面在wordpress中遵循以下格式:

页面参数:

enter image description here

这就是我所看到的:

enter image description here 火狐 enter image description here 任何帮助将不胜感激,谢谢。

0 个答案:

没有答案