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

WP SITES

2784

Original Genesis Tutorials & 6000+ Guaranteed Code

Snippets

  • Consultation
  • Full Access
  • Log in

Show The Content Limit And Custom Field Value For Specific Post Types In Search Results

The code in this download folder enables you to customize your search results. In this case, the code enables you to limit the content by number of words for standard post types as well as specific custom post types you name in the code.

This way you can show a customized excerpt of any length with a customized link back to the single entry. If a custom field has been added, this will also display as seen in the following image.

Search results showing content limit and custom field value for CPT's and standard post types

The image shows 3 entries returned when searching using CPT as the query.

  • The 1st entry prints the custom field value for the portfolio CPT followed by ( limited ) content for the same entry.
  • The 2nd entry prints the ( limited ) content for the property CPT. NO custom field value is printed as none added.
  • The 3rd entry prints the custom field value for the standard post type followed by ( limited ) content for the same entry.

Demo Video #

Shows limited ( by word ) content and custom field values for standard and custom post types, if it exists, on the search results page.

Tested using the Genesis Sample child theme by StudioPress. Works in any Genesis child theme and any WordPress parent theme.

Code Installation – From Download Folder #

There’s only 1 step :

Copy the PHP code to the end of your child themes functions file.

Register for full access

Related Tutorials

  • Show Custom Field Value And Or Content For CPT And Standard Post Types In Search Results
  • Use Custom Field Content For A Custom Post Type In Genesis Search Results

Custom Fields Custom Post Type Search

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.