• Rather than having a search bar in the sidebar I would like for the search to be in the body of a page. I’ve tried a few things but haven’t figured out how to accomplish this. Thank you in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You would need to remove <?php get_search_form(); ?> from your theme’s sidebar template and place it in another template file (e.g. page.php) or in a custom page template.

    After you remove that from the sidebar template and move it to the page.php, how do you go about putting the actual search bar on a page wherever you’d like?

    If you add it to page.php, it will be in every Page you publish. If you want it only on some pages, consider creating a custom page template and then assign that template to your Pages as, and when, the search bar is needed.

    Got it, thanks for the help but I’m still relatively new. I cant wait until I understand all of this as much as you do. Last ?, what coding do I place in the new custom page (do I only need <?php get_search_form(); ?>) and then how do I call/ask for the search bar to show up wherever I want? Any insight or links to learn this process is appreciated.

    Have you read the custom page template link above? If so, then I’d suggested adding <?php get_search_form(); ?> just after the Loop – e.g.:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h2><?php the_title(); ?></h2>
    <?php edit_post_link(); ?>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <?php  endif; ?>
    <?php get_search_form(); ?>

    That way you can add a little personalised content above the search form via the Admin Edit Page interface.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Search Bar in page’ is closed to new replies.