• Been bashing this around for a while and getting nowhere.

    Have used the following code

    // Custom Excerpt function for Advanced Custom Fields
    function custom_field_excerpt() {
    	global $post;
    	$text = get_field('the_excerpt'); //Replace 'your_field_name'
    	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('post_excerpt', $text);
    }

    in an attempt to change the default the_excerpt text to my ACF field. I need this change to come through in Elementor post widget but it isn’t playing. Am I doing something wrong in the code above or is there another way of achieving the same result.

    All thoughts appreciated

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Replace The Excerpt in Elementor Post widget with an ACF field’ is closed to new replies.