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.
Merge pull request #2471 from sc0ttkclark/patch-1

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