• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

Use Custom Field Content For A Custom Post Type In Genesis Search Results

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.

custom fields

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 :

custom-search-results-excerpts

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 :

Register for full access

Related Tutorials

  • Custom Fields On AgentPress Search Results Page
  • Show The Content Limit And Custom Field Value For Specific Post Types In Search Results
  • Show Custom Field Value And Or Content For CPT And Standard Post Types
  • Genesis Search Results Template You Can Fully Customize
  • Genesis Custom Search Results Page

Custom Fields Custom Post Type Search

Reader Interactions

Comments

  1. Tim Burkart says

    May 28, 2019 at 9:27 am

    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?

    Log in to Reply
    • Brad Dalton says

      May 28, 2019 at 12:47 pm

      Hello Tim.

      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/

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems