Skip to content

Makes it possible to add pages templates without creating a file in themes

Notifications You must be signed in to change notification settings

Underpin-WP/post-template-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Underpin post template Loader

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

  1. Install Underpin. See Underpin Docs
  2. 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');

About

Makes it possible to add pages templates without creating a file in themes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages