I currently have the following code to load an intro paragraph ACF field and if empty to load the excerpt:
<?php
if( get_field('intro_paragraph') ) {
the_field('intro_paragraph');
} else {
the_excerpt();
}?>
This as some older posts do not have the ACF Intro field populated. The excerpt it limited to 30 chars:
function custom_excerpt_length( $length ) {
return 30;
}
add_filter( 'excerpt_length', __NAMESPACE__ . '\\custom_excerpt_length', 999);
How can limit the output of a field to x amount of characters?