Nested custom post types templating

I found out how to solve this problem, and I hope I can help others in future.

My goal was to create an url structure like this: landen/land/rondreizen, with the use of multiple custom post types. ‘landen’ and ‘rondreizen’ are both custom post types. The templating structure should wordpress-like, act like this archive/single/archive. After long searching I found this tutorial on how to fix it, and it worked like a charm. However, there is one little pitfall which may prevent it from working somehow which I haven’t found out yet, but note that when you rewrite the url with your ‘nested’ custom post type name, it doesn’t work, so you need to register your custom post type under a different name from the url name you are rewriting.

If you want to have even deeper custom post type links, I suggest looking at this post.

Leave a comment if someone need help with this, and I’ll try to help.