How to use the plugin template file as a theme template in WordPress

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

Continue reading “How to use the plugin template file as a theme template in WordPress”