This code enables you to alter the content shown on the search results page in Genesis child themes. In this example, the default content is replaced with the content you add to a custom field named cpt_search.
This tutorial is based on a request from a member who wanted to create custom excerpts for CPT entries to be displayed on the search results page.
Here’s an example showing the 1st entry on the search results page displaying the custom field content and the 2nd entry showing the default excerpt based on the Genesis > Theme Settings > Content Archive settings :
Watch the following demo video to see how it works :
Demo Video #
Shows custom field content displaying on the search results page if added otherwise the default excerpt is displayed.
Code Installation #
There’s only 1 step :
Tim Burkart says
Thank you for the solution, Brad! I thought it worked until I coded the CSS for my CPT content. The class name is not output with the rest of the content.
I have two additional requests:
1) How can your solution be modified to display multiple custom fields, each on a new line?
2) How can the solution be modified to include the post excerpt along with the custom fields?
Brad Dalton says
This new tutorial provides the solution for your 1st question.
And this for the 2nd and both questions https://wpsites.net/web-design/show-the-content-limit-and-custom-field-value-for-specific-post-types-in-search-results/