Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I tried this in functions.php first:
- add_filter('relevanssi_excerpt_content', 'custom_fields_to_excerpts', 10, 3);
- function custom_fields_to_excerpts($content, $post, $query) {
- $images = get_post_meta($post->ID, 'gallery', true);
- if( $images ) {
- foreach( $images as $image ) {
- $content .= " " . $image['title'];
- $content .= " " . $image['caption'];
- }
- return $content;
- }
- }
- Then, I tried this version (unfortunately, neither worked):
- add_filter('relevanssi_excerpt_content', 'custom_fields_to_excerpts', 10, 3);
- function custom_fields_to_excerpts($content, $post, $query) {
- $images = get_field('gallery', $post->ID);
- if($images){
- foreach( $images as $image ) {
- $content .= " " . $image['title'];
- $content .= " " . $image['caption'];
- }
- }
- return $content;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement