I think that one of the more underrated aspects – or perhaps one of the rarely discussed aspects of custom plugin development – is the ability to include custom templates in our WordPress plugins.
And, to be honest, I get it: I’m one who is pretty staunch on what should a plugin and what should be a theme.
- themes are for presentation,
- plugins are functionality.
If I include templates in a plugin, am I not doing the same thing as when developers include functionality in their themes?
As with so many things in development, I think it depends. I mean, adding a lot of functionality that locks you into a theme is something of which I’m not a fan. Similarly, if you have a plugin that is meant to showcase data on the front-end and is theme agnostic, then it makes sense.
So you have to be judicious in your decisions.
Regardless, there’s a common set of steps we can use when including custom templates in our WordPress plugins.
And that’s what this post is going to show.