Skip to content

Instantly share code, notes, and snippets.

@tpitre
Last active September 20, 2022 13:23
Show Gist options
  • Save tpitre/74399d6a10c3fc6290b4a65d2871067f to your computer and use it in GitHub Desktop.
Save tpitre/74399d6a10c3fc6290b4a65d2871067f to your computer and use it in GitHub Desktop.
WP Timber/Twig Example Usage - Archive WP Template
<?php
/**
* The template for main archive pages.
*
* Methods for TimberHelper can be found in the /lib sub-directory
*
* @package WordPress
* @subpackage Timber
* @since Timber 0.1
*/
$context = Timber::context();
$context['posts'] = new Timber\PostQuery();
$context['post'] = new TimberPost();
$context['term'] = new Timber\Term();
$templates = array( '05-pages/archive.twig' );
Timber::render( $templates, $context );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment