Added the needed code to get the post from the WP_Query result.