docs/v1/guides/cookbook-twig.md
Imagine this scenario, I let the users set this in the Admin panel:
Copyright {{year}} by Upstatement, LLC. All Rights Reserved
But on the site I want it to render as:
Copyright 2013 by Upstatement, LLC. All Rights Reserved
Ready? There are a bunch of ways, but my favorite is:
In your PHP file
<?php
$data['year'] = date('Y');
$data['copyright'] = get_option("footer_message"); //"Copyright {{year}} by Upstatement, LLC. All Rights Reserved"
render_twig('footer.twig', $data);
In your HTML file (let's say footer.twig)
{% include template_from_string(copyright) %}
{% include "footer.twig" %}
child-theme/views directory first, then timber/views directoryUse a variable to determine the included file!
{% include ['blocks/block-'~block.slug~'.twig', 'blocks/blog.twig'] ignore missing %}
Huh?