/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_agenda()) { $post_type = get_queried_object(); $page = get_page_by_path('agenda-tickets'); $context['page'] = new TimberPost($page->ID); $context['posts'] = new Timber\PostQuery(); $context['filters'] = get_current_filters(); if ($type = get_query_var('soort')) { if ($type === 'films') { $context['categories'] = get_taxonomy_filters('category', 'cinema'); $context['facilities'] = get_taxonomy_filters('facility', 'cinema'); $context['movie_genres'] = get_taxonomy_filters('movie-genre', 'cinema'); $context['movie_versions'] = get_taxonomy_filters('movie-version', 'cinema'); $context['posts'] = maybe_sort_by_time($context['posts']); $context['days'] = get_date_filters('cinema', 'days'); } else { $types = [ 'activiteiten' => 'library', 'cursussen' => 'course', 'events' => 'event', 'films' => 'cinema', 'lezingen' => 'lecture', 'voorstellingen' => 'theatre' ]; $context['categories'] = get_taxonomy_filters('category', $types[$type]); $context['facilities'] = get_taxonomy_filters('facility', $types[$type]); $context['genres'] = get_taxonomy_filters('genre', $types[$type]); $context['months'] = get_date_filters($types[$type]); } } else { $context['categories'] = get_taxonomy_filters('category'); $context['facilities'] = get_taxonomy_filters('facility'); $context['movie_genres'] = get_taxonomy_filters('movie-genre'); $context['movie_versions'] = get_taxonomy_filters('movie-version'); $context['genres'] = get_taxonomy_filters('genre'); $context['months'] = get_date_filters(); } $template = ['agenda-archive.twig']; } else if (is_post_type_archive(['library', 'course', 'lecture', 'theatre', 'cinema', 'events'])) { $post_type = get_queried_object(); $page = get_page_by_path($post_type->rewrite['slug']); $context['page'] = new TimberPost($page->ID); $context['posts'] = new Timber\PostQuery(); $context['categories'] = get_taxonomy_filters('category'); $context['facilities'] = get_taxonomy_filters('facility', $post_type); $context['filters'] = get_current_filters(); $context['post_type'] = $post_type; if ($post_type->name === 'cinema') { $context['movie_genres'] = get_taxonomy_filters('movie-genre', $post_type); $context['movie_versions'] = get_taxonomy_filters('movie-version', $post_type); $context['posts'] = maybe_sort_by_time($context['posts']); $context['days'] = get_date_filters($post_type, 'days'); } else { $context['genres'] = get_taxonomy_filters('genre', $post_type); $context['months'] = get_date_filters($post_type, 'months'); } $template = ['agenda-' . $post_type->name . '-archive.twig', 'agenda-archive.twig']; } else if (is_singular(['library', 'course', 'lecture', 'theatre', 'cinema', 'events'])) { $post = new TimberPost(); if (post_password_required($post->ID)) { $template = 'page-password.twig'; } else { $context['future'] = is_future($post->performance_datetime_last); $context['arrangements'] = get_arrangements($post); $context['meta'] = json_decode($post->meta); $context['post'] = $post; $template = ['agenda-' . $post->post_type . '-single.twig', 'agenda-single.twig']; } } else if (is_post_type_archive('arrangement')) { $posts = new Timber\PostQuery(); $context['posts'] = group_arrangements_by_type($posts); $template = ['arrangement-archive.twig']; } else if (is_singular('arrangement')) { $post = new TimberPost(); $context['dates'] = group_arrangements_by_month($post); $context['post'] = $post; $template = ['arrangement-single.twig']; } else if (is_post_type_archive('case')) { $post_type = get_queried_object(); $page = get_page_by_path($post_type->rewrite['slug']); $context['page'] = new TimberPost($page->ID); $context['posts'] = new Timber\PostQuery(); $template = ['case-archive.twig']; } else if (is_singular('case')) { $context['post'] = new TimberPost(); $template = ['case-single.twig']; } else if (is_post_type_archive('facility')) { $post_type = get_queried_object(); $page = get_page_by_path($post_type->rewrite['slug']); $context['page'] = new TimberPost($page->ID); $context['posts'] = new Timber\PostQuery(); $context['terms'] = Timber::get_terms('venue'); $template = ['facility-archive.twig']; } else if (is_singular('facility')) { $context['post'] = new TimberPost(); $template = ['facility-single.twig']; } else if (is_singular('job')) { $context['post'] = new TimberPost(); $template = ['job-single.twig']; } else if (is_post_type_archive('news')) { $context['posts'] = new Timber\PostQuery(); $template = ['news-archive.twig']; } else if (is_singular('news')) { $post = new TimberPost(); $context['news'] = Timber::get_posts(['numberposts' => 15, 'post_type' => 'news', 'post__not_in' => [$post->ID]]); $context['post'] = $post; $template = ['news-single.twig']; } else if (is_catalogus()) { $template = ['catalogus-archive.twig']; } else if (is_catalogus_details()) { $template = ['catalogus-single.twig']; } else if (is_page()) { $context['post'] = new TimberPost(); if (post_password_required($context['post']->ID)) { $template = 'page-password.twig'; } else { $template = ['page-' . $context['post']->_wp_page_template . '.twig', 'page.twig']; } } else if (is_search()) { $posts = new Timber\PostQuery(); $context['posts'] = group_results_by_type($posts); $template = ['search.twig']; } else if (is_404()) { $template = ['errors/404.twig']; } Timber::render($template, $context); ?>