Last March, I wrote a post on How To Include a Page Template in a WordPress Plugin. The post and the associated code was a proof-of-concept that was never intended to be used in production environments.
But since then, I’ve received a few pull requests and have implemented some additional changes that have brought this plugin up to a stable
1.0.0 that I believe is capable of being used in a more stable setting.
Include a Page Template in WordPress Plugin
You can checkout the project on GitHub, but the point of the project is simple: Provide a way for developers to easily include templates to work with themes within the context of their plugins.
Page Template Example is a plugin that shows one strategy for how to do that.
Here’s a general rundown of how the plugin works:
- Add your templates to the templates directory
- Define the template location in an associative array in the plugin (and covered in the
Easy enough, right?
With the demo, you get the following:
- A copy of the plugin, fully documented and internationalized
READMEthat walks you through how to get started
ChangeLogfor those that are curious about all of the changes
- Two example templates used to show how to put the plugin to work
As is the case with most of the open source projects, I gotta give thanks to all of those who contributed to this release.
And, as usual, for those of you who discover bugs or are looking to add more functionality to the plugin, don’t hesitate to open an issue or submit a pull request!