check for global 'post' before calling get_the_ID()