Add wp_reset_postdata()
after your while
loop:
endwhile;
wp_reset_postdata();
endif;
This will ensure that, after your shortcode runs, the actual current post is restored, so that any template tags display the right data.
Add wp_reset_postdata()
after your while
loop:
endwhile;
wp_reset_postdata();
endif;
This will ensure that, after your shortcode runs, the actual current post is restored, so that any template tags display the right data.