get_template_part causes 500 error

I am trying to list posts in a widget I am working on at the moment. However, when I use the get_template_part function in my loop, my site just keeps loading until I get a 500 http error.

$args = array(
‘numberposts’ => 10,
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
‘post_type’ => $postType,
‘suppress_filters’ => true
);
$postsQuery = new WP_Query( $args );

if ( $postsQuery->have_posts() ) {
while ( $postsQuery->have_posts() ) {
get_template_part( ‘content/content’, $postType );
}
/* Restore original Post Data */
wp_reset_postdata();
}

When I comment the get_template_part out, everything works just fine. Also the loop seems to loop perfectly through the posts. Just the get_template_part is somewhat problematic. I don’t have any idea, how I could figure out what the problem is. Any ideas? Maybe I am using it wrong or something?

Read more here:: get_template_part causes 500 error

Leave a Reply

Your email address will not be published. Required fields are marked *