• Resolved ttmt

    (@ttmt)


    Hi all

    I have a Cusotom Post Type called retail_testimonials to get testimonials.

    I have a field group Retail Testimonial that is placed on the retail_testimonials Custom Post Type.

    The Retail Testimonial group has a field called the_testimonial.

    I’m using wp_Query to loop through the Custom Post Type

    How do I get the value from the_testimonial

    <?php
    
    	$retail_test_args = array(
    		'post_type' => 'retail_testimonials',
    		'posts_per_page' => 3,
    		'orderby' => rand,
    		'order' => 'DESC'
    	);
    
    	$retail_test_loop = new WP_Query($retail_test_args);
    
    	if($retail_test_loop->have_posts()):
    		while($retail_test_loop->have_posts()):
    			$retail_test_loop->the_post();	
    
    	$test = cfs()->get($retail_test_loop['the_testimonial'])
    ?>
    
    <div class="col-sm-4">
    
    	<?php echo $test;?>
    
    </div>
    
    <?php endwhile; endif; ?>
    
    <?php wp_reset_postdata(); ?>

    https://www.ads-software.com/plugins/custom-field-suite/

Viewing 1 replies (of 1 total)
  • Plugin Author Matt Gibbs

    (@mgibbs189)

    Hi,

    You just need to use CFS()->get( 'the_testimonial' );

    FYI – if you like the plugin, please consider giving it a good rating ??

    Cheers

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Post Type wp_Query’ is closed to new replies.