Archived topic
Search box on posts page
5 replies · Started by Denis on March 13, 2018
Hello,
I want to display a search box on top (like on this website) on blog posts page only.
How could I do it?
Thanks in advance.
Hi there,
Try adding this:
<?php get_search_form(); ?>
In the Before Content hook:
http://demo.generatepress.com/hook-locations/
https://docs.generatepress.com/article/hooks-overview/
Make sure execute PHP is checked.
Thank you Leo!
I used this PHP code in the hook
<?php
if ( is_home() && ! is_front_page() ) {
get_search_form();
}
?>
BTW is it possible to call a hook from functions.php? I'd prefer to keep active DISALLOW_FILE_EDIT
That works!
Thank you
No problem!