megclaypool
4/24/2019 - 8:24 PM

Function to add data to Timber context for all templates in functions.php

[Function to add data to Timber context for all templates in functions.php]

add_filter('timber_context', 'add_to_context');

function add_to_context($data){
    /* this is where you can add your own data to Timber's context object */
    $data['foo'] = 'bar';
    return $data;
}