/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_front_page()) { $positions = ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right']; shuffle($positions); $context['featured'] = get_field('featured', 'option'); $context['positions'] = $positions; $template = ['home.twig']; } else if (is_post_type_archive('project')) { $posts = Timber::get_posts(); $template = ['project-index.twig']; } else if (is_singular('project')) { $context['post'] = Timber::query_post(); $layout = get_field('layout', $context['post']->ID); $template = ($layout == 'new') ? 'project-single-new.twig' : 'project-single.twig'; } else if (is_post_type_archive('event')) { $posts = Timber::get_posts(); $template = ['event-index.twig']; } else if (is_singular('event')) { $context['post'] = Timber::query_post(); $template = ['event-single.twig']; } else if (is_page()) { $context['post'] = new TimberPost(); $template = ['page.twig']; } else if (is_post_type_archive('news')) { $context['posts'] = Timber::get_posts(); $template = ['news-index.twig']; } else if (is_singular('news')) { $context['post'] = Timber::query_post(); $template = ['news-single.twig']; } else if (is_post_type_archive('team')) { $posts = Timber::get_posts(); $template = ['team-index.twig']; } else if (is_singular('team')) { $context['post'] = Timber::query_post(); $template = ['team-single.twig']; } else if (is_404()) { $template = ['errors/404.twig']; } Timber::render($template, $context); ?>