Custom Search Results Using Layout Builder

Hi, I’m trying to create a custom search results page using the layout builder. I understood this was possible, and it’s referenced in this forum post - Custom results search page

However, while that shows how to create a template layout and assign it, it doesn’t advise what combination of loopers or consumers to use in order to get it to display the search results.

I’m still getting my head round the whole looper and consumer elements, but I’ve played with query builder etc rather than the default ‘Recent Posts’ and I can’t get it to display dynamic search results, just lists of pages, posts or similar.

Can you please advise what looper provider or other settings I’d need on a layout builder page to make my search page display search results?

Site URL: https://staging3.rachel-ashcroft.co.uk/ - do any search and you’ll see rather than searching pages, posts, products and so on, it just displays the same recent posts. Thanks

Thank you.

Hi James,

Thanks for reaching out.
While you select any of the predefined templates in the Layout Builder it will load the predefined structure of Loopers Consumers. I would also request you go through the following videos and documentation on the Looper.

Hope this helps.
Thanks

Hi there,

Thanks for the reply. I have watched both those videos already. I do understand the basics, and that if I have the looper provider set to recent posts, that’s why it’s only showing posts, not search results.

What I’m asking is, what query or looper provider settings would I need to be able to have it query the search results and output them to however I set the elements in the looper consumer element? As normal search results would output, posts, pages, or other custom taxonomies. So how to I get a looper provider to output those?

Many thanks

Hi James,

You can use the Query String option to add the WP Query parameters for search, but that does not allow you to capture the parameter that comes through the URL.

test-new-Content-Pro (12)

I would like to inform you that a few hours ago we have released another version of the theme with some fixes, I would recommend you to update your theme to the latest one.

Hope it helps.
Thanks

Hi there,

Thanks for your response. Yes I did try WP Query, but as you say, it still didn’t work as it wasn’t capturing the search parameter type in the search box (or subsequent URL). This being the case, going back to my original question, is there a way to create a layout that allows customisation of a search page and using a looper provider to output search results that are queried by the user?

If there isn’t, how would one use a layout to create a search results page?

I have also updated the theme as per your suggestion, thank you.

Kind regards,

James

Hello James,

In your custom search results custom layout, you will use the “Query String” in combination with the Seach Query dynamic content as your Looper Provider:

For reference:

Hi there,

Thanks for that reply, I’ve got that working great now thanks to your advice. So thank you very much.

James

You are most welcome as always James.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.