Home › Forums › Front-end Issues › custom field group not displaying in wp query loop for a custom post › Reply To: custom field group not displaying in wp query loop for a custom post
Here is the full code on the page. I am not using namespace b/c that causes problems when I do, so I commented out the namespace.
<?php
/**
* Testimonial block
*
* @package SWD\swd_realtor_theme
* @subpackage Testimonial Block
* @author Superfly Web Designs
* @since 1.0.0
* @license GPL-2.0+
**/
//namespace SWD\swd_realtor_theme;
echo ‘<section id=”testimonial_grid” class=””>’;
$testimonial_include_image = get_field(‘testimonial_include_image’);
$testimonial_how_many = get_field(‘testimonial_how_many’);
$testimonial_cols = get_field(‘testimonial_cols’);
$testimonial_author = get_field(‘testimonial_author’);
$testimonial_content = get_field(‘testimonial_content’);
$testimonial_image = get_field(‘testimonial_image’);
echo ‘<div class=”grid grid-3″>’;
$args = array(
‘posts_per_page’ => -1,
‘post_type’ => “testimonial”,
‘post_status’ => “publish”,
);
//loop
$testimonials = new WP_Query($args);
while($testimonials->have_posts()): $testimonials->the_post(); ?>
<div>
<?php if( get_field(‘testimonial_content’) ): ?>
<p class=”swd_testimonial_content”><?php the_field(‘testimonial_content’); ?></p>
<?php endif; ?>
</div>
<?php endwhile;
wp_reset_postdata();?>
</div>
</section>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.