Created
November 16, 2018 19:37
-
-
Save pattyok/f4a1fb48d705a81fac03c95a4d7fa873 to your computer and use it in GitHub Desktop.
ACF Flexible Field Content in Relevanssi
This file contains 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 | |
//ADD Flexible content to Relevanssi | |
add_filter('relevanssi_excerpt_content', __NAMESPACE__ . '\\custom_fields_to_excerpts', 10, 3); | |
function custom_fields_to_excerpts($content, $post, $query) { | |
$sections = get_field('sections', $post->ID); | |
if ($sections) { | |
foreach ($sections as $section) { | |
if ($section['acf_fc_layout'] == 'content_editor') { | |
$content .= $section['content']; | |
} | |
} | |
} | |
return $content; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment