WordPress搜索结果仅显示管理员是否已登录

时间:2017-10-17 16:08:46

标签: wordpress search

WordPress搜索结果仅显示管理员是否已登录 我尝试停用插件,但是没有用。以下是search.php文件中的代码(如下所示)。不确定这是问题所在还是其他地方。

如果它在function.php文件中:

<?php
/**
 * The template for displaying search results pages.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
 *
 * @package Wowmall
 */

get_header();
$col      = 'col-xl-12';
$post_col = 'col-xl-3 col-lg-4 col-md-6 col-sm-12 col-xs-12';
$template = '';
global $wp_query,$wowmall_options;
if( ! empty( $wowmall_options['blog_layout_type'] ) && ! in_array( $wowmall_options['blog_layout_type'], array( 'grid', 'masonry' ) ) ) {
    $col      = 'col-xl-10 col-lg-9 col-md-8';
    $post_col = 'col-xs-12';
    $template = '-list';
}
?>
<div class="container">

    <header class=page-header>
        <h1 class="page-title page-title-search"><?php printf( esc_html__( 'Search Results for %s', 'wowmall' ), '<span class=wowmall-search-query-title>&#x27;' . get_search_query() . '&#x27;</span>' ); ?></h1>
    </header><!-- .page-header -->
    <div class="row">
        <main id=primary class="content-area site-main <?php echo esc_attr( $col ); ?>">
            <?php if ( have_posts() ) : ?>
            <div class="page-content">
                <div class="row posts-<?php echo count( $wp_query->posts ); ?>">

                <?php /* Start the Loop */ ?>
                <?php while ( have_posts() ) : the_post(); ?>
                    <div class="<?php echo esc_attr( $post_col ); ?>">
                    <?php
                    /**
                     * Run the loop for the search to output the results.
                     * If you want to overload this in a child theme then include a file
                     * called content-search.php and that will be used instead.
                     */
                    get_template_part( 'template-parts/content', '' );
                    ?>
                    </div>
                <?php endwhile; ?>
                </div>
            </div>
            <?php the_posts_pagination( array(
                'prev_text' => '<i class=myfont-left-open-2></i>',
                'next_text' => '<i class=myfont-right-open-2></i>',
                'type'      => 'list',
            ) ); ?>

            <?php else : ?>

                <?php get_template_part( 'template-parts/content', 'none' ); ?>

            <?php endif; ?>

        </main>

        <?php get_sidebar(); ?>
    </div>
</div>

<?php get_footer(); ?>

0 个答案:

没有答案