lars-m of PartnersCreative
12/4/2017 - 6:08 PM

Best WP Loop I've seen

This is the best loop that I have used

<?php
    $args = array(
    'post_type' => 'testimonial',
    'posts_per_page' => -1,
    );
    $loop = new WP_Query($args);

    if ($loop->have_posts()):

        while ( $loop->have_posts() ) : $loop->the_post(); ?>
<h2 class="name"><?= get_field('name') ?></h2>
<div class="title"><?= get_field('title') ?></div>
<div class="company"><?= get_field('company') ?></div>
<div class="testimonial"><?= get_field('testimonial') ?></div>
<?php endwhile;
endif;
?>