Community Forums › Forums › Archived Forums › Design Tips and Tricks › Simple SIdebars for search results page
Tagged: sidebars, streamline
- This topic has 9 replies, 2 voices, and was last updated 10 years, 10 months ago by Brad Dalton.
-
AuthorPosts
-
June 15, 2013 at 9:42 am #46096ecoofficegalsMember
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 GalsJune 15, 2013 at 10:58 am #46108Brad DaltonParticipantYou 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.
June 15, 2013 at 11:06 am #46109ecoofficegalsMemberHey 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 GalsJune 15, 2013 at 3:37 pm #46164Brad DaltonParticipantJune 15, 2013 at 3:50 pm #46168ecoofficegalsMemberWe 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 GalsJune 15, 2013 at 4:16 pm #46173Brad DaltonParticipantI 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.
June 15, 2013 at 4:33 pm #46181ecoofficegalsMemberI 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 GalsJune 15, 2013 at 4:36 pm #46184ecoofficegalsMemberMaybe 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 GalsJune 15, 2013 at 5:01 pm #46193ecoofficegalsMemberYou 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 GalsJune 15, 2013 at 5:08 pm #46194Brad DaltonParticipant -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.