I’ll do my best to explain.
I want to be able to place a testimonials box anywhere in my page from the WordPress editor using shortcode – [testimonials_box]
[testimonials_box]: Queries a custom post type = testimonials.
Since it’s added in a page loop it’s a nested loop and I can’t get it to work.
Page:
Title
Content
[testimonials_box]
More Title
More Content
How would I go about doing this?
— Start Page Loop —
if (have_posts()) : while (have_posts()) : the_post();
— Start Custom Post Type Loop —
$query = new WP_Query( array ( ‘post_type’ => ‘testimonials’ ) ); while ( $query have_posts() ) : $query->the_post();
echo it
endwhile;
— End Custom Post Type Loop -;
endwhile; ?>
else : ?>
endif; ?>
–End Page Loop —