alpipego / awp-template
wp.template and locate_template loader
Installs: 1 487
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: ^7.1|^8.0
- alpipego/awp-assets: ~0.3|dev-master
Suggests
README
WordPress template loader for reusable templates for wp.template
and locate_template
Usage
Obtain instance of Template
, either by instantiating it directly or using TemplateFactory
's build
method.
/**
* Template constructor.
*
* @param array $template Uses `locate_template` to prioritize templates @see locate_template()
* @param string $name Id passed to `wp.template`
* @param array $data optional array of unchanging data
*/
public function __construct(array $template, string $name, array $data = [])
Pass an array (may be empty) to the render
method on the Template
to render php template. Don't pass anything to render a wp.template
.