Archived topic
Shortcode for the WordPress search form?
3 replies · Started by Henry on April 9, 2019
I'd like to add the generic WordPress search form to a page - my question is - what is the 'best approach' for this using GeneratePress? Is there some functions.php code that I is recommended for this?
function shapeSpace_display_search_form() {
return get_search_form(false);
}
add_shortcode('display_search_form', 'shapeSpace_display_search_form');
I found the above - is this ok? Any thoughts?
Hi there,
looks good to me :)
Thanks David
Just to follow up on this - it works great but the styling goes completely weird on smaller screens. I'm sure the CSS can be tidied up.
On a chrome desktop I just need a little padding as is evident here: https://screencast.com/t/pAPBNlUVZIA
But on mobile (Chrome, iPhone 7) the submit button adopts gradient sides.
So - my question is - how do you suggest I go about CSS styling the Vanilla WP search form within GP?
Thanks!
This CSS should stop the mobile browsers styling:
.search-form input {
-webkit-appearance: none;
-webkit-border-radius: 0;
}
How would you like the search to look? You have any examples?