PHP code example of iantsch / wp-hbs-engine
1. Go to this page and download the library: Download iantsch/wp-hbs-engine library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iantsch / wp-hbs-engine example snippets
add_filter('MBT/Engine/Handlebars/Helpers', function($helpers) {
$helpers['__'] = function($string) {
return __($string, 'mbt');
};
$helpers['permalink'] = 'get_permalink';
$helpers['content'] = function() {
return apply_filters('the_content', get_the_content());
};
return $helpers;
});
global $post;
while (have_posts()){
the_post();
$data = (array) $post;
the_hbs_template('article', $data);
}