Is it possible to create a theme template for WP Search?

I’m currently working on a site using the Beaver Builder theme. We have disabled the standard header and footer across the site so we can use our own layout.

I’m not quite sure what to do when it comes to the standard WordPress Search results.

i.e.: http://example.com/?s=searchterm

Because we have the default header and footer turned off the search results are displayed on the page without any website theming at all. I’ve tested enabling the theme header and footer and specifically disabling them on each of the main website pages but this still leaves the search page looking considerably different from the rest of the website.

Is there any way to create a Seach page using the Beaver Builder plugin and divert any search results to be displayed on that page instead?

I’m imagining a function in functions.php to rewrite /?S=term to /searchpage/term and then creating a custom module that displays the search results in the main content area?

Are there any better ways to do this? Basically we’d like the Search results page to use the same template / layout as the rest of the site, ideally editable via the Page Builder.

Thank you!

Hey Phill,

Thanks for getting in touch! Sorry but we you won’t be able to edit that using the page builder. Pretty much the same problem with posts.

You could try using the Insert Pages plugin though. Basically, this allows you to call content using a shortcode. Since you have your header/footer layout saved as a template, you can create your own search.php file and call your header/footer layouts using the said shortcode in the file itself. You then need to load those templates’ assets globally using the fl_builder_global_posts. Let me know if you need help with that.

Ben

Hi Phill,

Instead of customing Search page, you might want to install Predictive Search. This way the Search posts will be shown as drop down list and user has to click on item itself, rather than to be taken to Search page and selecting item.

Costa

Hey Costa,

That’s a neat suggestion! Never knew those existed! :slight_smile:

Ben

Hi Ben!

Sorry for the long delay in getting back to this.

So if I understand correctly we create a template file (search.php, content-single.php etc) ensure we use fl_builder_global_posts to load the css/js, create a shortcode for inserting the relevant Builder Beaver global / saved header and footer row? Then in the php template file we use do_shortcode() to pull and display the template content?

Let me know if I’ve got it or if I’m completely on the wrong track :smiley:

Any more detailed steps would be appreciated. Thanks!

Hey Phill,

That’s perfect! Here’s the link to the Insert Pages plugin.
https://wordpress.org/plugins/insert-pages/

Let us know if you need anything further! :slight_smile:

Ben

Thanks Ben!

I’ll give it a go in the next couple of days and will get back to you with any questions. Appreciate your help!