Simple SIdebars for search results page

Community Forums Forums Design Tips and Tricks Simple SIdebars for search results page

This topic is: not resolved

This topic contains 9 replies, has 2 voices, and was last updated by  braddalton 1 year, 6 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #46096

    ecoofficegals
    Participant
    Post count: 25

    I’m using the simple sidebars plugin for Genesis in a Streamline theme and would like a sidebar we created ID blog-sidebar to show on search results pages like http://www.indiebusinessnetwork.com/?s=cvxkjvlj instead of the primary sidebar, is this possible and how? Thanks in advance.

    Jen


    Jen Smith
    Owner, Eco-Office Gals

    • This topic was modified 1 year, 6 months ago by  ecoofficegals.
    • This topic was modified 1 year, 6 months ago by  ecoofficegals.
    #46108

    braddalton
    Participant
    Post count: 10667

    You mean on 404 page not found error results?

    Otherwise there’s a conditional tag for search pages which you could use with a custom sidebar template. I don’t think you can use it with the simple sidebars plugin.


    #46109

    ecoofficegals
    Participant
    Post count: 25

    Hey Brad,

    No I mean if you go to http://www.indiebusinessnetwork.com/blog/ and put a nonsense search in the field we have a search result page set up like http://www.indiebusinessnetwork.com/?s=sfkldjk to allow people to search again, that sidebar on that page is the primary sidebar my client wants the blog page sidebar to show up.

    The purpose is so when results do show up, but not the results they are looking for like say http://www.indiebusinessnetwork.com/?s=ibn they don’t have the search fiels in the content of the page so she wants the blogsidebar to be there so that the search field is there. She doesn’t want the search field on the primary sidebar.


    Jen Smith
    Owner, Eco-Office Gals

    #46164

    braddalton
    Participant
    Post count: 10667

    So you have a custom template named search-no-results?


    #46168

    ecoofficegals
    Participant
    Post count: 25

    We used most of this code http://ahjira.com/create-a-custom-genesis-search-results-page-for-no-posts-found/ in the theme functions file.

    This is what we have in there:

    //* Custom search results page
    remove_action( ‘genesis_loop_else’, ‘genesis_do_noposts’ );
    add_action( ‘genesis_loop_else’, ‘my_do_noposts’ );
    function my_do_noposts() {

    $term = $_GET[‘s’]; // store the search term in a variable

    echo ‘<div class=”entry-content”>';
    echo ‘<div class=”post”>';

    printf( ‘<p>%s</p>’, apply_filters( ‘genesis_noposts_text’, __( ‘<p>Sorry, but nothing matched your search criteria for: <strong>’ . $term . ‘</strong>.</p><p>Please try again with some different keywords below.</p>’, ‘genesis’ ) ) );

    printf( ‘<div class=”genesis-search”>’ . get_search_form() . ‘</div>’ );

    echo ‘</div><!– close entry-content –>';
    echo ‘</div><!– close post –>';
    }


    Jen Smith
    Owner, Eco-Office Gals

    #46173

    braddalton
    Participant
    Post count: 10667

    I can’t test that code because it hasn’t been embedded properly.

    Is this the exact code you are using:

    It seems to include another file named search-helper.php which is not a Genesis file.


    #46181

    ecoofficegals
    Participant
    Post count: 25

    I tried to put it in the comments Github but I guess I don’t know what I’m doing it messed up.

    It’s correct  minus a few lines, the H1 class, the include search helper (yes we didn’t use this in it) and the actual content wording, added is the

    add_action( ‘genesis_loop_else’, ‘my_do_noposts’ );


    Jen Smith
    Owner, Eco-Office Gals

    #46184

    ecoofficegals
    Participant
    Post count: 25

    Maybe this is right

    <script src=”https://gist.github.com/ecoofficegals/15422385addbc9bd1e03.js”></script>

    Otherwise here is the link https://gist.github.com/ecoofficegals/15422385addbc9bd1e03 again that’s if I did it right


    Jen Smith
    Owner, Eco-Office Gals

    #46193

    ecoofficegals
    Participant
    Post count: 25

    You can disregard this I talked the client into putting the search back into the primary. I don’t think you should make your readers search for a way to search your site :) Thanks!


    Jen Smith
    Owner, Eco-Office Gals

    #46194

    braddalton
    Participant
    Post count: 10667
Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.