underpin / post-template-loader
Post Template Loader for Underpin
Installs: 119
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/underpin/post-template-loader
Requires
- underpin/underpin: ^2.0
This package is auto-updated.
Last update: 2025-09-25 05:30:19 UTC
README
Loader That assists with adding post templates to a WordPress website.
Installation
Using Composer
composer require underpin/post-template-loader
Manually
This plugin uses a built-in autoloader, so as long as it is required before Underpin, it should work as-expected.
require_once(__DIR__ . '/underpin-post-templates/post-templates.php');
Setup
- Install Underpin. See Underpin Docs
- Register new post templates as-needed.
Example
A very basic example could look something like this.
\Underpin\underpin()->post_templates()->add( 'template', [ 'name' => 'Template Name', // Shows in dropdown 'template' => 'template-name' // Shows when post template is fetched, and in REST ] );
Alternatively, you can extend post template
and reference the extended class directly, like so:
underpin()->post_templates()->add('key','Namespace\To\Class');