I have created a PHP template file called mypage.php and it is accessible at site.com/mycoolpage
As I am working with data I am hoping to learn how to accomplish this:
site.com/mycoolpage -> How to determine it is the main plugin page and no variables or path are submitted?
site.com/mycoolpage/things -> This should rewrite to site.com/mycoolpage?page=things
site.com/mycoolpage/things/add -> site.com/mycoolpage?page=add_things
site.com/mycoolpage/add -> invalid, treat as if it were main page
site.com/mycoolpage/stuff -> site.com/mycoolpage/?page=stuff
site.com/mycoolpage/stuff/add?id=42 -> site.com/mycoolpage?page=add_stuff&id=42
I’ve read about rewrite rules, rewrite tags, and query vars, but I keep going down rabbit holes trying to accomplish this. Any help appreciated!
[ad_2]