Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMena Graham
2,178 PointsHow to build a Wordpress theme - Testimonials not showing
Hi there,
I'm having troubles @ extending Wordpress template functionality => adding content in custom places - part 1: my testimonials aren't showing but the " " and title are showing. I think it must have something to do with the following code from the content-testimonials.php:
<div class="divider grid_12 omega">
<h5>Feedback</h5>
</div>
<?php
$args = array(
'post-type' => 'feedback',
'posts_per_page' => 1,
'orderby' => 'rand'
);
$the_query = new WP_Query( $args );
?>
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="testimonial push_2 grid_10 clearfix">
<blockquote>“ <?php the_field( 'feedback' ); ?> ”</blockquote>
<cite>— <?php the_field( 'name' ); ?> </cite>
</div>
<?php endwhile; endif; ?>
Any help would be very much appreciated.
Thanks guys :)
Mena
3 Answers
Zac Gordon
Treehouse Guest TeacherTry post_type instead of post-type
Joakim Bergman
14,501 PointsHave you got the Advanced Custom fields plugin setup properly? Seems like it is the_field() that isn't working as it should. Are you sure the fields are called 'feedback' and 'name' in ACF?
Mena Graham
2,178 PointsThanks Joakim and Zac! The post_type did it - I can't believe all that time I spent starring at the code I couldn't see it :( Thanks so much :) Mena