Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1352785

    Hey guys,

    I’m just looking for an easy way to edit my search results page.

    I want to add a few things, such as sidebars similar to my homepage, which only appear on PC devices.
    How do I do that? Also a line separator with an AdSense code below the search results.

    Thank you

    BR,
    M

    #1352800

    but isn’t it the default behavior that search results page got a sidebar?

    you can manage the position by that snippet:
    (if you like a sidebar left … you know what to change?)

    
    function avia_change_layout_for_searchresults($layout, $post_id) {
        if( is_search() ) {
            $layout['current'] = $layout['sidebar_right'];
            $layout['current']['main'] = 'sidebar_right';
        }
        return $layout;
    }
    add_filter('avia_layout_filter', 'avia_change_layout_for_searchresults', 10, 2);
    

    if you like to show a custom sidebar on that page you can do it via:

    add_filter("avf_custom_sidebar", function($custom_sidebar) {
        if( is_search() ) {
            $custom_sidebar = "Your Custom Sidebar Name"; 
        }
        return $custom_sidebar;
    }, 10, 1);
    #1352802

    by the way – if it is a common Side Bar – the name you had to enter is exactly what you see on your widgets:

    so it is “Sidebar Pages” for pages widgets

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.