Fix for when there is no $post on the page in shortcode

This is a direct follow-up to #2215 and fixes an additional $post->ID use.