What is the proper way to display plugin pages?

[ad_1]

Hello, first let me say that this is an internal plugin (used on my own site only) and won’t be released or handled by any external developers. So let’s say that I am making a plugin that will display content (dynamic and static). I want to be able to use pretty links such as “site.com/my page”. My research shown so far that these are the options:

– Create a copy of page.php and use a template page
– Create a page and use a short code
– Use things like rewrite rules, routes, some sort of pseudo is_page() thing?

Can someone help me understand which one is best used in which case? Or the benefits/drawbacks of each? Ideally I would like to not have to use option 1, and 2 isn’t the best either. It seems better to make the “pages” programmatically, especially due to the fact that I will be putting these pages together with pieces/views from my src/ folder of my plugin. Currently it seems hindering to have to make an actual page for everything as this is a bigger development and that could make implementing changes a pain. However, if it is going to be an ordeal to learn how to make the page from the program, we will use the page options. One thing is that due to the dynamic nature content, I’d like to be able not have to use register_pages and have to keep activating/deactivating the plugin.

So if the best option is to do it from the program as we are hoping, could I please get an example or point in the direction to have a programmatic page be handled by a php function?

Any help? Thank you all in advance 🙂

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer