/wp-admin/plugins.php'; return; } if (!class_exists('acf') ) { echo 'ACF not activated. Make sure you activate the plugin in /wp-admin/plugins.php'; return; } $context = Timber::get_context(); if (is_page()) { $post = new TimberPost(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (is_valid_action()) { validate_and_process_request($post); exit(); } wp_safe_redirect($post->link); exit(); } $context['post'] = $post; $template = ['pages/' . $post->_wp_page_template . '.twig', 'page.twig']; unset($_SESSION['errors'], $_SESSION['post']); } else if (is_singular('subscription')) { $post = new TimberPost(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (is_valid_action()) { validate_and_process_request($post); exit(); } wp_safe_redirect($post->link); exit(); } $context['post'] = $post; $template = ['subscription.twig']; unset($_SESSION['errors'], $_SESSION['post']); } else if (is_post_type_archive('faq')) { $context['posts'] = new Timber\PostQuery(); $template = ['faq-archive.twig']; } else if (is_singular('faq')) { $context['post'] = new TimberPost(); $template = ['faq-single.twig']; } else if (is_post_type_archive('video')) { $context['posts'] = new Timber\PostQuery(); $template = ['video-archive.twig']; } else if (is_singular('video')) { $context['post'] = new TimberPost(); $template = ['video-single.twig']; } else if (is_post_type_archive('manual')) { $context['posts'] = new Timber\PostQuery(); $template = ['manual-archive.twig']; } else if (is_singular('manual')) { $context['post'] = new TimberPost(); $template = ['manual-single.twig']; } else if (is_post_type_archive('news')) { $context['posts'] = new Timber\PostQuery(); $template = ['news-archive.twig']; } else if (is_singular('news')) { $context['post'] = new TimberPost(); $template = ['news-single.twig']; } else if (is_search()) { $context['posts'] = new Timber\PostQuery(); $template = ['search.twig']; } else if (is_404()) { $template = ['errors/404.twig']; } Timber::render($template, $context); ?>