If the plugin contains some UI components, we can easily use it in the theme’s UI by putting widgets, shortcodes, JS enqueued scripts etc.
But there might be some plugins which may have completely independent UI template.
What to do in such cases? The plugin may have its own template with its own CSS, JS, UI – Say active theme is built on some custom CSS framework – but your plugin should use its own UI built on Bootstrap Framework. So they can’t live together if we just enqueue the plugin’s CSS, JS and use our UI as a shortcode or widget.
The only normal ways seems to create theme template logic inside the plugin.
Fortunately, it is possible and doesn’t need additional hacks and cheats.
Let’s first create some empty template file inside the plugin’s directory, called “the_plugins_template_file.php” – Custom Template
Now we just need to introduce it to WP Core. We add these 2 functions to our plugin’s main file.
And the last step – just create new page dedicated to your plugin’s custom UI , grab its ID and replace THE_PAGE_ID_OF_THE_PAGE_DEDICATED_TO_THE_PLUGIN_UI constant with that ID in the last code given above.