your code seems to be correct.
Here is the process to debug it:
- As your code is correct (what I can see), you need to update your htaccess. To perform it, go to the permalinks WP section and save again permalinks (keep your structure).
- If not working, you need to flush rewrite rules on your function.php template
- If not working, you need to check the name of your custom template
- If not working, you need to remove your query variable with static variables (to find the if this is a template issue – wp template condition as been tested before)
- If not working, from an empty project, add you CPT an CT to review if there is any problem with plug-in etc
- If not working, send me a link to your staging server, I will find the issue in less than 5 min.
Hope this help