sourceboat/wp-pug

This package is abandoned and no longer maintained. No replacement package was suggested.

Use Pug template engine in WordPress.

Installs: 153

Dependents: 0

Suggesters: 0

Security: 0

Stars: 8

Watchers: 6

Forks: 0

Open Issues: 0

Type:wordpress-muplugin

1.0.2 2017-06-05 16:39 UTC

This package is auto-updated.

Last update: 2020-11-19 08:23:29 UTC


README

⚠️ Deprecated: This project is not actively maintained anymore. Use it at your own risk.

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.