Advanced Custom Fields – Add Field to Specific Page [closed]

You have two options. Either use get_field or the_field. get_field just reads out the field from the db without and screenoutput. like you did in your first line:

$fields = get_field('testimonial');

the_field instead is get_field with an implied echo.

<?php the_field('testimonial'); ?>

so basically the_field would be enough. Aside you have to write a wp_query before and aside i would go with if and while instead of foreach. Like e.g.

        $args = array(
            'post_type' => 'testimonials'
        );
        $the_query = new WP_Query( $args );
        if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
            <?php the_field('testimonial'); ?>

        <?php endwhile;
            wp_reset_postdata();
        else: ?>
            <p>Error</p>
        <?php endif; ?>

(you would have to refine the query args but basically it would do the trick)