I have a template section that displays testimonials. The testimonials have been set up as a post type and will be given categories to match product names. Here is the testimonial section:
<div class="testimonials-section">
<div class="container">
<div class="row justify-content-center">
<div class="col-12 col-lg-8 col-md-12 col-sm-12 this-column">
<div class="autoplay testimonials-container">
<?php
$args = array( 'post_type' => 'testimonials', 'posts_per_page' => 999 );
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="entry-content">';
the_content();
echo '<h3>';
the_field('job_title');
echo ' / ';
the_title();
echo '</h3></div>';
endwhile;
else :
echo wpautop( 'Currently no Testimonials.' );
endif;
wp_reset_query();
?>
</div>
</div>
</div>
</div>
</div>
What I want to do is display testimonials on my single-products.php page if the product name matches the testimonial category.
Here is where I got to but I throw a critical error. Please excuse my ignorance, I am a beginner.
<?php
$ptitle = $product->get_name();
if (is_testimonial_category()) == $ptitle ) :
echo 'YES, this is where I would add in the above code....';
endif;
?>