implode()
is intended to take an array and convert it to a string. Unless the value of $degree
is an array, you’re going to get an error.
If $degree
is already a string value, there’s no need to implode()
it.
I’m guessing here because you didn’t include any information in your question about where the name comes from and if the “degree” field is simply the degree. So the following is based on an assumption that the_title()
is the name and $degree
simply contains the degree as a string (such as “PhD”).
$degree = get_field( 'degree', $post->ID );
<h4 class="block-slider-faculty__slide__details__title"><?php the_title(); ?>, <?php echo $degree; ?></h4>
Of course, if there is a possibility that $degree
is empty, you’d have to also account for that, so the following might be better in that regard:
$degree = get_field( 'degree', $post->ID );
$degree_output = ( $degree ) ? ", " . $degree : '';
<h4 class="block-slider-faculty__slide__details__title"><?php the_title(); echo $degree_output; ?></h4>
(Also note above, there’s no need in the second example (nor your original) to close PHP and then reopen it right away.)