Hello, how can we use the excerpt of repeater content and excerpt length? Is there any way to call excerpt like the_excerpt()?
Thank you.
Not really, You’ll need to create your own function that does everything that WP does.
// add something like this to functions.php
function fredy_custom_excerpt($text) {
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$excerpt_length = apply_filters('excerpt_length', 55);
$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
return wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
‘
// when getting the field
echo fredy_custom_excerpt(get_sub_field(‘wysiwyg_field_name’));
‘
the function was taken from here and changed as needed http://wordpress.stackexchange.com/questions/37618/apply-filters-and-the-excerpt-are-giving-unexpected-results