搜索栏在搜索类别时无效

时间:2015-07-10 06:31:32

标签: php wordpress function sidebar searchbar

我在侧边栏中添加了一个搜索栏,并在header.php中进行了调用。它仅适用于不属于类别的帖子/产品。请帮助我了解将会搜索类别的自定义search.php。我的search.php文件在这里......

<?php if ( have_posts() ) : ?>
<header class="page-header">
    <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'MySite' ), get_search_query() ); ?></h1>
</header><!-- .page-header -->
<?php
    // Start the Loop.
    while ( have_posts() ) : the_post();
        /*
         * Include the post format-specific template for the content. If you want to
         * use this in a child theme, then include a file called called content-___.php
         * (where ___ is the post format) and that will be used instead.
         */
        get_template_part( 'content', get_post_format() );
    endwhile;
        // Previous/next post navigation.
    MySite_paging_nav();
    else :
        // If no content, include the "No posts found" template.
    get_template_part( 'content', 'none' );
    endif;
?>

0 个答案:

没有答案