Show Custom Field Value And Or Content For CPT And Standard Post Types In Search Results

This download folder contains 3 different code snippets.

The code customizes the search results enabling you to return the custom field value and/or content for single posts and/or specific custom post types.

Snippet 1 – Returns CPT custom field value & the content for portfolio and property CPT’s only. Excludes standard posts. Here’s a actual result :

Returns CPT custom field value & the content for portfolio and property CPT's only. Excludes standard posts

Snippet 2 – Returns CPT & Post custom field values & the content for posts and portfolio CPT only. Excludes other CPT’s. Here’s a actual result :

Returns CPT & Post custom field value & the content for posts and portfolio CPT only

Snippet 3 – Returns CPT & Post custom field values & the content for posts and 2 different CPT’s. Here’s the actual result :

Returns CPT custom field values & the content for posts and 2 different CPT's

Demo Video #

Shows the result generated by the the 3rd code snippet returning search results for the CPT custom field values & the content for posts and 2 different CPT’s.

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

Code Installation – From Download Folder #

There’s only 1 step :

Copy one of the code snippets to the end of your child themes functions.php file and modify the code to match the name of your posts types. Example :

Related Tutorials

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.