Closed michelbrons closed 1 year ago
Hi, sorry for the late reply. I've tried and it seems to work fine with a minor change in Timber theme.
Here's how to do it:
docker compose exec php composer require timber/timber:^2.0
docker compose exec php composer require upstatement/timber-starter-theme:^2.0 -W
Then in wp/content/themes/timber-starter-theme/theme/functions.php
:
// --- Remove those lines
$composer_autoload = dirname( __DIR__ ) . '/vendor/autoload.php';
if ( file_exists( $composer_autoload ) ) {
require_once $composer_autoload;
Timber\Timber::init();
}
// --- Replace with this line:
Timber\Timber::init();
Then active the theme and it works.
I didn't try with Timber 1.x but it should work by changing your Twig requirements in your composer.json
to remove the conflict.
It works with 2.0 indeed. it is still in beta, but 2.0 feels more like the way to go (not as a plugin, but via composer).
Timber is a popular wordpress plugin to use twig in your template. https://github.com/timber/timber/ This plugin also loads a twig package, so it is giving a conflict, i guess with autoloading.
Is it possible to add support for Timber? Or maybe better: support plugins which uses the same namespace.