/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() || is_page()) { $context['post'] = new TimberPost(); $template = ['page-' . $context['post']->_wp_page_template . '.twig', 'page.twig']; } else if (is_post_type_archive('project')) { $post_type = get_post_type_object('project'); $page = get_page_by_path($post_type->rewrite['slug']); $context['page'] = new TimberPost($page->ID); $context['posts'] = new Timber\PostQuery(); $template = ['project-archive.twig']; } else if (is_singular('project')) { $context['post'] = new TimberPost(); $template = ['project-single.twig']; } else if (is_singular('maker')) { $context['post'] = new TimberPost(); $template = ['maker-single.twig']; } else if (is_post_type_archive('news') || is_tax(['subject'])) { $post_type = get_post_type_object('news'); $page = get_page_by_path($post_type->rewrite['slug']); $context['page'] = new TimberPost($page->ID); $context['subjects'] = Timber::get_terms('subject', ['hide_empty' => true]); $context['posts'] = new Timber\PostQuery(); $context['term'] = new Timber\Term(); $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); ?>