Seach page output

Hello,

I’m surprised I can’t find anything on this. How can I have the search results page show a lists of posts and custom post type results. Right now it just shows a bunch of text on a page. I don’t see a way to configure this.

I added my CPT to the search results with this:

function ns_include_resources_in_search($query) {
  if (!is_admin() && $query->is_search && $query->is_main_query()) {
    $query->set('post_type', ['post', 'page', 'resources']);
  }
}
add_action('pre_get_posts', 'ns_include_resources_in_search');

Any help much appreciated!

Hello Jesse,

Thanks for writing in! Are you using the Pro theme with the Blank or Starter stack? You may need to create a custom Archive Layout that will serve as your Search Results page. Please check out this documentation first:

Or check out the tutorials here:

Hope this helps.

Hi,

Thanks, Yes I’m using the starter stack. Ok so I need to build my own custom archive page for the search results? I’ll give it a go.
Cheers,

Hello @jsullivan,

Please let us know how it goes.

Thanks

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