-
AuthorPosts
-
July 26, 2013 at 11:57 pm #26802
Hello,
I just need some help editing search.php to display a custom sidebar.
Thank you!
July 29, 2013 at 8:18 pm #131650Hi finchkelsey,
You can create a new sidebar via a function (http://codex.wordpress.org/Function_Reference/register_sidebar) and then change the http://codex.wordpress.org/Function_Reference/get_sidebar function in the search.php file to point at your new specific sidebar.
Regards,
Devin
July 29, 2013 at 9:57 pm #131651Thanks,
I replaced
<?php
//get the sidebar
$avia_config = ‘page’;
get_sidebar();
?>
with
<?php get_sidebar( $general ); ?>
The ‘display everywhere’ sidebar is still displaying.
How do I get one of my custom sidebars to display on search.php
Thanks
July 30, 2013 at 6:10 am #131652Hi,
Edit search.php, find this code:
//get the sidebar
$avia_config['currently_viewing'] = 'page';
get_sidebar();Replace it with:
//get the sidebar
$avia_config['currently_viewing'] = 'page';
echo '<div class="sidebar sidebar_right three alpha units"><div class="inner_sidebar extralight-border">';
dynamic_sidebar( 'search-sidebar' );
echo '</div></div>';Go to includes > admin > register-widget-area.php, find this code:
foreach ($sidebars_to_show as $sidebar)
{
register_sidebar(array(
'name' => 'Sidebar Pages',
'before_widget' => '<div id="%1$s" class="widget clearfix %2$s">',
'after_widget' => '<span class="seperator extralight-border"></span></div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>',
));
}Below, add this code:
foreach ($sidebars_to_show as $sidebar)
{
register_sidebar(array(
'name' => __( 'Search Sidebar' ),
'id' => 'search-sidebar',
'before_widget' => '<div id="%1$s" class="widget clearfix %2$s">',
'after_widget' => '<span class="seperator extralight-border"></span></div>',
'before_title' => '<h3 class="widgettitle">',
'after_title' => '</h3>',
));
}Go to Appearance > Widget, add a widget on the Search Sidebar widget area.
Regards,
Ismael
July 31, 2013 at 6:19 pm #131653So awesome!
Thank you!
-
AuthorPosts
- The topic ‘search.php / search results page sidebar’ is closed to new replies.
