'post', 'posts_per_page' => 9, 'paged' => $paged ); $context['posts'] = new Timber\PostQuery( $args ); $template = '04-templates/overview-blog/overview-blog.twig'; } /* * Search results Template */ elseif ( is_search() ) { global $query_string; if ( !empty( get_search_query() ) ) { wp_parse_str( $query_string, $search_query ); $context['items'] = new Timber\PostQuery( $search_query ); $context['search_query'] = get_search_query(); if ( $context['search_query'] !== '' ) { $context['results_count'] = $context['posts'] ->found_posts; } else { $context['results_count'] = 0; } } $context['pagination' ] = Timber::get_pagination(); $template = '04-templates/search-results/search-results.twig'; } /* * Archive Templates */ elseif ( is_archive() ) { $context['post'] = new TimberPost(); $context['pagination'] = Timber::get_pagination(); /* * Blog Category */ if ( is_category() ) { $context['taxonomy'] = 'category'; $context['post']->title = get_the_archive_title(); $context['posts_per_page'] = get_option('posts_per_page', 9); $context['found_posts'] = $context['posts']->found_posts; $context['post_type'] = 'post'; $template = '04-templates/overview-blog/overview-blog.twig'; } /* * Blog Overview Page */ elseif ( is_post_type_archive( 'blog' ) ) { $context['post']->title = get_the_archive_title(); $context['posts_per_page'] = get_option('posts_per_page', 9); $context['found_posts'] = $context['posts']->found_posts; $context['post_type'] = 'post'; $template = '04-templates/overview-blog/overview-blog.twig'; } /* * press Category Overview Page */ elseif ( is_tax( 'press-categories' ) ) { $context['taxonomy'] = 'press-categories'; $context['post']->title = get_the_archive_title(); $context['posts_per_page'] = get_option('posts_per_page', 9); $context['found_posts'] = $context['posts']->found_posts; $context['post_type'] = 'press'; $template = '04-templates/overview-blog/overview-blog.twig'; } /* * Event Overview Page */ elseif ( is_post_type_archive( 'event' ) ) { $context['taxonomy'] = 'event-categories'; $context['post']->title = get_the_archive_title(); $template = '04-templates/overview-events/overview-events.twig'; } /* * Event Category Overview Page */ elseif ( is_tax( 'event-categories' ) ) { $context['taxonomy'] = 'event-categories'; $context['post']->title = get_the_archive_title(); $template = '04-templates/overview-events/overview-events.twig'; } /* * Material Category Page */ elseif ( is_tax( 'material-categories' ) ) { $context['taxonomy'] = 'material-categories'; $context['post']->title = get_the_archive_title(); $context['posts_per_page'] = get_option('posts_per_page', 9); $context['found_posts'] = $context['posts']->found_posts; $context['post_type'] = 'material'; $template = '04-templates/overview-blog/overview-blog.twig'; } elseif ( is_tag() ) { $context['post']->title = get_the_archive_title(); $context['posts_per_page'] = get_option('posts_per_page', 9); $context['found_posts'] = $context['posts']->found_posts; $context['post_type'] = 'post'; $template = '04-templates/overview-blog/overview-blog.twig'; } elseif ( is_author() ) { $context['post']['title'] = 'Posts by: ' . get_the_author(); $context['posts_per_page'] = get_option('posts_per_page', 9); $context['found_posts'] = $context['posts']->found_posts; $context['post_type'] = 'post'; $template = '04-templates/overview-blog/overview-blog.twig'; } elseif ( is_date() ) { $context['post']['title'] = get_the_archive_title(); $context['posts_per_page'] = get_option('posts_per_page', 9); $context['found_posts'] = $context['posts']->found_posts; $template = '04-templates/overview-blog/overview-blog.twig'; } } Timber::render( array( $template . '', 'base-page.twig' ), $context );