views:

39

answers:

1

Hi,

My search.php file makes reference to a function call of:

    <?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' );
    ?>

which all seems to work fine with bringing back my search results but I also want to display my sidebar and footer sections but this get_template_part seems to override it.

Any ideas how to still display both my sidebar and footer info within the search.php file result page?

It seems to have it's own div section as my sidebar either appears above or below result set.

Thanks.

A: 

Use a custom WP Query (retrieve only pages given in a specific array) similar to this one:

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

For more information to build it specific to your needs see: http://codex.wordpress.org/Function_Reference/WP_Query

Todd Moses
Hi @Todd, unsure how this relates to my query by where inside my search.php file, I also want this page to display both my sidebar and footer info using get_sidebar and get_footer together with the results from the search process. At the moment, I can't seem to get both sidebar and get_template_part() working together. Thanks.
tonsils