Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26802

    Hello,

    I just need some help editing search.php to display a custom sidebar.

    Thank you!

    #131650

    Hi 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

    #131651

    Thanks,

    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

    #131652

    Hi,

    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

    #131653

    So awesome!

    Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘search.php / search results page sidebar’ is closed to new replies.