Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.
/ wp-pug Public archive

Use Pug template engine in WordPress.

License

Notifications You must be signed in to change notification settings

sourceboat/wp-pug

Repository files navigation

⚠️ 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.