toolbox_timber_posts_data

Estimated reading: 1 minute

This filter allows you to extend the data for the ACF Field Module and Timber Posts Module even further. It will also allow you to expose custom variables to the Twig template by passing them into this filter.

Parameters

  • $data (array)

Usage

<?php

add_filter( 'toolbox_timber_posts_data' , 'my_custom_data' ,10 ,1 );

function my_custom_data( $data ) {
    $data['mydata'] = array(
                        'firstname' => 'John',
                        'lastname'	=> 'Doe'
                  );
    return $data;
}

After which you can use the variables in your Twig template.

{# render context variable mydata and its sub variable firstname #}
{{ mydate.firstname }}
Share this Doc

toolbox_timber_posts_data

Or copy link

CONTENTS