Fix PHP warnings and when processing 404 page for product

Initialize $is_404 to true instead of false if we know we are processing a 404
Check for the existence of a valid $post class member in the $wp_query global before accessing it