2010-09-17 94 views
1

我的search.php文件提及到的函数调用:WordPress的搜索 - Get_Template_Part

<?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

使用自定义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

+0

嗨@Todd,不知道该如何这涉及到我的查询用在我的search.php中的文件里面,我也希望这个页面来显示我的两个侧边栏和页脚信息使用get_sidebar并与结果一起get_footer搜索过程。目前,我似乎无法同时使用侧边栏和get_template_part()。谢谢。 – tonyf 2010-09-18 00:02:27