How can I base a query off of the current page post type AND a meta value from another custom post type

** Edited after large discussion below **

Ok so here is a link to a gist which should work.

If it does not, I’m honestly out of ideas, but this demonstrates how to set up a new query, including an example that should be pretty spot on to what you need, perhaps you may just need to change some values.

Link to the Widget Gist

There are some comments in there explaining some of the though processes, overall my reasoning was that if the meta-select field has a value of the post_ID for the location it belongs to, then when you are on that location’s page the main $post->ID should be the value you need to search for when querying by the meta-key ‘meta-select’.

If this doesn’t work, try just inserting the query and loop into the template for the locations post type – if it works there but not in the widget that indicates that there is something wrong with your widget setup.

Overall, with the information I’ve given you here and a reasonable grasp of PHP you should be able to get this to work, if you don’t know PHP at all and are just google-copy-pasting then troubleshooting this for your specific setup might be beyond your abilities and you should engage the (paid) services of a developer.