Open hamedmoody opened 7 years ago
You should google the Timber Framework
but i need herbert framework, is not any way?
You use both, Timber is an addon for twig specifically for Wordpress
id use "composer require timber/timber". but what i do next?
After that create a 'views' folder inside your app folder.
then you render using this code:
use Timber\Timber;
...
$context = Timber::get_context();
$context['VARIABLE_TO_ASSIGN_TO_TWIG'] = "foo";
Timber::render("path/to/template.twig", $context);
You can also use Twig's registerUndefinedFunctionCallback()
without having to include Timber. There are some caveats though. Check out the documentation for defining undefined functions on the fly.
Hi. How use wordpress and php functions in twig template. Thanks for your best framework.