Home › Forums › General Issues › Custom Post Types & Index.php › Reply To: Custom Post Types & Index.php
You’d have to overwrite what WordPress uses to generate the excerpt.
You could try something like this … (untested)
function filter_function_name( $excerpt ) {
global $post;
// Only do this on certain post types
if('custom-post-type' == get_post_type($post)){
// Generate a 140 character excerpt
$excerpt = substr(get_field('your_flexible_field',$post->ID),0,140);
}
return $excerpt;
}
add_filter( 'get_the_excerpt', 'filter_function_name' );
Reference:
https://codex.wordpress.org/Plugin_API/Filter_Reference/get_the_excerpt
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.