php - How to build a subpage based on a parameter in WordPress?

I have created a custom template for Event custom post type. All events are under /events/[event-name]. This page is a sort of dashboard. From here you can select different modules (always related to that particular event). Now I'd like to create a sub page for each module, passing module ID as a parameter.
So, when I visit /events/[event-name] I see the Event's dashboard. From here, if I click on module with ID 2, for example, it opens a new page in /events/[event-name]/2. All these pages should be created using only one template (example: template-module.php).
How can I achieve this? Thanks
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: a non-numeric value encountered
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.