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.
53 lines
2.6 KiB
53 lines
2.6 KiB
<?php
|
|
/**
|
|
* Template Name: New Main Page
|
|
* Description: Front page template
|
|
*/
|
|
|
|
if (!class_exists('Timber')) {
|
|
echo 'Timber не установлен. Пожалуйста, активируйте плагин Timber.';
|
|
return;
|
|
}
|
|
|
|
function theme_enqueue_scripts() {
|
|
wp_enqueue_style('gp-front-page-materialize-css', get_template_directory_uri() . '/static/css/libs/materialize.min.css');
|
|
// wp_enqueue_style('gp-front-page-style', get_template_directory_uri() . '/static/css/front-page.css');
|
|
wp_enqueue_style('gp-front-page-style', get_template_directory_uri() . '/static/css/new-front-page.css');
|
|
wp_enqueue_script('gp-front-page-materialize', get_template_directory_uri() . '/static/js/libs/materialize.min.js', array(), null, true);
|
|
// wp_enqueue_script( 'gp-front-page-main', get_template_directory_uri() . '/static/js/front-page.js', array(), null, true );
|
|
wp_enqueue_script('gp-front-page-main', get_template_directory_uri() . '/static/js/new-front-page.js', array(), null, true);
|
|
}
|
|
add_action('wp_enqueue_scripts', 'theme_enqueue_scripts');
|
|
|
|
$context = Timber::context();
|
|
|
|
if (function_exists('get_field')) {
|
|
// main
|
|
$context['main_slider'] = get_field('main_slider');
|
|
// about
|
|
$context['main_about_title'] = get_field('main_about-title');
|
|
$context['main_about_image'] = get_field('main_about-image');
|
|
$context['main_about_text'] = get_field('main_about-text');
|
|
$context['main_about_banner_bg'] = get_field('main_about-banner-bg');
|
|
$context['main_about_banner_title'] = get_field('main_about-banner-title');
|
|
$context['main_about_banner_descr'] = get_field('main_about-banner-descr');
|
|
// why
|
|
$context['main_why_title'] = get_field('main_why-title');
|
|
$context['main_why_items'] = get_field('main_why-items');
|
|
$context['main_why_text'] = get_field('main_why-text');
|
|
$context['main_why_logos'] = get_field('main_why-logos');
|
|
// ingredients
|
|
$context['main_ingredients_title'] = get_field('main_ingredients-title');
|
|
$context['main_ingredients_slider'] = get_field('main_ingredients-slider');
|
|
// specialists
|
|
$context['main_specialists_title'] = get_field('main_specialists-title');
|
|
$context['main_specialists_items'] = get_field('main_specialists-items');
|
|
}
|
|
|
|
try {
|
|
Timber::render('_pages/new-front-page.twig', $context); // Рендерим отдельный Twig-шаблон
|
|
} catch (Exception $e) {
|
|
error_log('Ошибка рендеринга: ' . $e->getMessage());
|
|
echo 'Произошла ошибка при рендеринге шаблона. Проверь логи: ' . $e->getMessage();
|
|
}
|
|
?>
|