WP Manifestindependent plugin directory
manifest / developer / mustacciuoli

Mustacciuoli WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA

Mustache template engine for WordPress.

★ 9stars
1.1.4latest · 11 years ago

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/unfulvio/mustacciuoli/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

NOTE: This project is no longer maintained. Please fork and update it if you want to use it.

Adds Mustache template engine support to WordPress with one of its PHP and one of its Javascript implementations so you can use Mustache template files in your theme development and reuse the same template files across two languages.

An interesting case use would be combining Mustache with WordPress JSON REST API to supply JSON data to your Mustache template files, for example.

Installation

Install the plugin as you would with any WordPress plugin in your wp-content/plugins/ directory or equivalent.

Once installed, activate Mustacciuoli from WordPress plugins dashboard page and you're ready to go, Mustache PHP library will be loaded already and mustache.js script enqueued.

Usage (PHP)

To render a template file in PHP you need to follow Mustache.php instructions, for example:

// instantiate Mustache
$mustache = new Mustache_Engine( array(
    'loader'          => new Mustache_Loader_FilesystemLoader( 'your-path-to/templates' ),
    'partials_loader' => new Mustache_Loader_FilesystemLoader( 'your-path-to/templates/partials' ),
    'charset'         => get_bloginfo( 'charset' ),
    'cache'           => 'your-path-to/cache',
) );

// load template in a variable
$template = $mustache->loadTemplate( 'your-template-file' );
// render (output) the compiled template by echoing it
echo $template->render( array( 'your-vars') );

You could register $mustache as a global in your functions.php file and use it across your theme, so you won't need to instatiate Mustache multiple times.

Usage (Javascript)

Refer to mustache.js documentation.

Don't need the JS support? If you want to disable mustache.js, you can de-queue the script with this code in your theme functions.php file (an example):

function dequeue_mustacciuoli() {
    wp_dequeue_script( 'mustacciuoli' );
}
add_action( 'wp_print_scripts', 'dequeue_mustacciuoli', 100 );

FAQ

Why this is not available on WordPress.org?

WordPress lacks of a template engine and for theming and templating encourages mixing PHP and HTML, adding function and logic to presentation, often resulting in a spaghetti mess. This has been very controversial. At the same time different developers came with different solutions to the problem, usually fit to their personal or team workflow - which is all reasonable. Mustacciuoli is in no way different. However, the guys at the official WordPress.org Plugin's directory realized that all this may confuse users and have made a rule to exclude frameworks, boilerplates, and developer libraries such as those included in this plugin from the official repository for the time being. Therefore, please refer to this repo on Github for updates/contributions/support, thank you.

Releases

4 releases.

Tag
Published
1.1.4 latest
Jun 19, 2015 11 years ago
Dec 15, 2014 11 years ago
Dec 11, 2014 11 years ago
Nov 10, 2014 11 years ago

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.

A grade

Security

Mustacciuoli 1.1.4 · audited by WP Registry

No security issues found.

Audited release
1.1.4
Findings
none
Worst severity
—
Content hash
1a67945b2a66d3ddb4fa0f7c…

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.