WordPress搜索 - Get_Template_Part

时间:2010-09-17 16:12:55

标签: wordpress wordpress-theming

我的search.php文件引用了一个函数调用:

    <?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 loop-search.php and that will be used instead.
     */
         get_template_part( 'loop', 'search' );
    ?>

这一切似乎都可以正常工作,但是我还想显示我的侧边栏和页脚部分,但是这个get_template_part似乎会覆盖它。

如何在search.php文件结果页面中同时显示我的侧边栏和页脚信息?

似乎有自己的div部分,因为我的侧边栏显示在结果集的上方或下方。

感谢。

2 个答案:

答案 0 :(得分:0)

我不知道你的问题是否得到了解决。但只是为了信息,可以创建一个搜索页面模板。详细信息在此codex页面中提供。

http://codex.wordpress.org/Creating_a_Search_Page#Using_the_page.php

答案 1 :(得分:-2)

使用与此类似的自定义WP查询(仅检索特定数组中给出的页面):

<?php
$args=array(
   'post_type'=>'page',
   'post__in' => array('595', '33', 44)
);
$the_query = new WP_Query($args);
?>

有关根据您的需求进行构建的详细信息,请参阅:http://codex.wordpress.org/Function_Reference/WP_Query

相关问题