I'm trying my hands at developing a plugin but have run into an issue I can't seem to find any good answers to.
I want users to put a shortcode on any page they want, and the shortcode is replaced with custom content from my plugin. So far I've achieved this and replace the shortcode with a PHP file.
However, I have seen other plugins do the following, but I don't know how:
I would like all subsequent page requests to go to the same page, where the included PHP file handles which content is being displayed.
Say I add a page with the URL /mypage On this page I add the shortcode [mytag]. This code is, for example, replaced with a list of links. One link points to /mypage/one and another to /mypage/two
I don't want to create subpages called "one" and "two", but I want the included PHP file to do its custom stuff. Some stuff for "one" and other stuff for "two".
How can I create such rewrite rules so that they work no matter what page (or subpage) you put the shortcode on? How should the PHP file included in the shortcode handle these subpages (or sub-subpages)?