-
-
Save searchwpgists/08eac891d3c47da4dd54221d7916bb45 to your computer and use it in GitHub Desktop.
Append custom content for a specific post type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Customize SearchWP result entry data for the SearchWP template. | |
| add_filter( 'searchwp\results\entry\data', function( $data, $result ) { | |
| if ( $result instanceof \WP_Post && $result->post_type === 'product' ) { | |
| $data['content'] .= '<p>Free delivery available!</p>'; | |
| } | |
| return $data; | |
| }, 20, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment