The loop was working fine until I added the query to further customize my loop. What am I doing wrong?
I've tried adding wp_reset_postdata(); before the closing end while & end if to no avail. Unless there's another issue that I'm not seeing?
<?php
$args = array(
'orderby' => 'rand',
'posts_per_page' => '5',
);
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ) {
$my_query->the_post();
get_template_part( 'template-parts/content/entry_cards', get_post_type() );
} // end while
} // end if
?>
I would like to be able to see 5 of my WordPress posts in a random order (as stated in my array).
$args
array, needs'post_type' => 'post'