Hello,
I have been trying to add a search form to my website with a shortcode by adding
add_shortcode('search_sc', 'get_search_form');
to functions.php. When I add the shortcode to a text field in the avia layout builder the search button appears on top of the search bar and not on the right side. How could I fix this?
Thank you.
Edit: or is it possible to add a search form like in the header to the main part of the website? I would prefer that since i like the live search and especially the styling.
it looks like this:
Hey!
Please go to Enfold theme options > Header > Extra Elements and check “Append search icon to main menu”
Cheers!
Yigit
Thank you but I have already checked this. But I would like to have the search bar on the content part of the website.
Hi!
On what part of the page exactly do you want the search bar to show? You can append the search bar anywhere you like. Add this on functions.php:
add_filter( 'avf_content_search', 'avia_append_search_nav', 10, 2 );
If you want the search icon to show on the single post content, edit single.php. Find this code on line 40:
//show related posts based on tags if there are any
get_template_part( 'includes/related-posts');
Below, add this code:
echo '<nav class="main_menu content-search"><div class="avia-menu"><ul id="avia-menu" class="menu">';
echo apply_filters('avf_content_search', "", 'fallback_menu');
echo '</ul></div></nav>';
Add this on Quick CSS:
.main-menu.content-search {
width: 100%;
display: block;
position: relative;
margin: 0;
}
You’ll the search icon at the very bottom of the posts.
Regards,
Ismael