Skip to content

Docs for adding Timber to an existing theme. #2581

Closed Answered by jarednova
james0r asked this question in Q&A
Discussion options

You must be logged in to vote

@james0r I couldn't find a good tutorial, but here's a quick snippet

/* index.php */

/* other stuff going on in your index.php file up here */
$context          = Timber::context();
$context['posts'] = new Timber\PostQuery();
$context['foo']   = 'bar';
$templates        = array( 'index.twig' );
Timber::render( $templates, $context );
// here is where you'll get output from whatever is in index.twig + $context

/* other stuff going on in your index.php file down here */

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Levdbas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants