From a3276b07847a9f3caf95a62a374aef1bf32b2dd9 Mon Sep 17 00:00:00 2001 From: Mike Manger Date: Thu, 6 Oct 2016 15:34:20 +0100 Subject: [PATCH] Use get_posts instead of WP_Query Reapplying 7473ed as it got mistakenly overwritten by 4928d8 --- public/class-library.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/public/class-library.php b/public/class-library.php index 1e02eb1..8f0115e 100755 --- a/public/class-library.php +++ b/public/class-library.php @@ -126,19 +126,14 @@ public function shortcode( $atts ) { 'post_type' => 'library_term', ); - $query = new WP_Query( $args ); + $posts = get_posts( $args ); $output = ''; - if ( $query->have_posts() ) { - while ( $query->have_posts() ) { - $query->the_post(); - $output = get_the_content(); - } + foreach ( $posts as $post ) { + $output = $post->post_content; } - wp_reset_postdata(); - return $output; }