try looking up a post by slug if we got a 404

related to https://github.com/GigaOM/gigaom/issues/5121
* cached post ids looked up by slug
* moved post slug to post id code out of template_redirect() action
* also filter by post_type
* better names for a function and a class var
* pass $wp_query into the convenience method instead of heaving it find it in the environment
* comments
Merge pull request #4 from wluo/github-5121

try looking up a post by slug if we got a 404