Custom made twig filters

Step 1. register the filter in a plugin

Add the following to the plugin.php of your plugin (but use your own filter function):

public function registerMarkupTags() {
    return [
        'functions' => [
            ...
        ],
        'filters' => [
            'uppercase' => [ $this, 'makeTextAllCaps' ]
        ]
    ];
}

public function makeTextAllCaps( $text ) {
    return strtoupper( $text );
}

Step 2. Use the filter

<div class="col-xs-12">
     <h1 class="entry-title post-header">{{title|uppercase}}</h1>
     <div class="entry-content">
         <!-- page -->{% page %}<!-- end-of-page -->
     </div>
</div>
Last update: September 17th at 8:39am