You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
<?
|
|
|
|
use Timber;
|
|
use Timber\PostCollection;
|
|
use Timber\Integrations\WooCommerce\Product as TimberProduct;
|
|
|
|
|
|
Timber::$dirname = [
|
|
[
|
|
'modules',
|
|
'templates'
|
|
],
|
|
];
|
|
|
|
|
|
add_filter( 'timber/integrations', function ( array $integrations ): array {
|
|
$integrations[] = new \Timber\Integrations\WooCommerce\WooCommerceIntegration();
|
|
return $integrations;
|
|
} );
|
|
|
|
add_action('timber/init', function() {
|
|
// Инициализируем WooCommerce интеграцию
|
|
if (class_exists('Timber\Integrations\WooCommerce\WooCommerce')) {
|
|
Timber\Integrations\WooCommerce\WooCommerce::init();
|
|
}
|
|
});
|
|
|
|
|
|
// Add the function to the Timber context
|
|
add_filter('timber/context', function($context) {
|
|
$context['template_path'] = get_template_directory_uri();
|
|
$current_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
|
$context['current_url'] = htmlspecialchars($current_url);
|
|
return $context;
|
|
});
|
|
|
|
|
|
add_action('init', function() {
|
|
add_filter('timber/context', function($context) {
|
|
$context['current_lang'] = pll_current_language();
|
|
return $context;
|
|
});
|
|
}, 1);
|
|
|