Use Pug template engine in WordPress.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.editorconfig
.gitignore
.travis.yml
api.php
composer.json
composer.lock
index.php
license.md
package.json
phpcs.xml
readme.md
yarn.lock

readme.md

WP Pug

Packagist Packagist Downloads Build Status

Use Pug template engine in WordPress. It uses pug-php under the hood.

Installation

To use this plugin you need to setup your WordPress installation via a Composer setup like Bedrock. Then you can install it via:

$ composer require sourceboat/wp-pug

Usage

Template Directory

The Plugin expects your templates to be under a views folder in your active theme.

Helper

The plugin exposes the following helper functions:

  • render_template($name, $data = []) - renders a template and prints the output.
  • get_template_content($name, $data = []) - renders a template and returns the output as string.

Arguments:

  • $name - the template name relative to the template directory without file extension.
  • $data (optional) - array with local variables wich get passed to the template.

WP-CLI

The plugin supports WP-CLI. The following commands are available:

$ wp pug cache warmup // caches all template files.
$ wp pug cache clear // clears all cached template files.