Adding the global $post; to the widget method so that $post should be set and available for use just like in normal template use.