Support

Account

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