Skip to content

Instantly share code, notes, and snippets.

@alexwoollam
Created March 6, 2019 21:54
Show Gist options
  • Save alexwoollam/b65be2f865c0d22db377447fd30bb4c9 to your computer and use it in GitHub Desktop.
Save alexwoollam/b65be2f865c0d22db377447fd30bb4c9 to your computer and use it in GitHub Desktop.
It's possible to use namespaces by hooking onto the timber/loader/loader filter.
add_filter( 'timber/loader/loader', function( $loader ){
$loader->addPath( __DIR__ . "/views/components", "components" );
return $loader;
} );
// To use the namespace in your Twig template, just include it with an @ prefix.
{{ include( '@components/filename.twig' ) }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment