Home Forums Add-ons Flexible Content Field Possible to get excerpt from sub_field? Reply To: Possible to get excerpt from sub_field?

  • Hey there. I am having the exact same problem. It is not possible to create a custom excerpt from a sub_field. The solution you suggested won’t work.

    This is my code:

    function custom_product_excerpt() {
    $text = get_sub_field(‘text_left’);
    if ( ” != $text ) {
    $text = strip_shortcodes( $text );
    $text = apply_filters(‘the_content’, $text);
    $text = str_replace(‘]]>’, ‘]]>’, $text);
    $excerpt_length = 20; // 20 words
    $excerpt_more = apply_filters(‘excerpt_more’, ‘ ‘ . ‘[…]’);
    $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    return apply_filters(‘the_excerpt’, $text);

    The sub field is a WYSIG-Field. I also tried it with a sub field of type textarea. Both don’t work.

    Are there any suggestions?