ID ) ) { $children = get_pages("child_of=".$context['post']->ID."&sort_column=menu_order"); $redirect_url = get_permalink( $children[0]->ID ); wp_redirect( $redirect_url ); exit; } // Templates if ( is_home() ) { $template = 'page-home.twig'; $context['page'] = 'home'; } elseif ( is_front_page() ) { $template = 'page-front.twig'; $context['page'] = 'front-page'; } elseif ( is_singular() ) { $template = get_post_type() . '.twig'; $context['page'] = get_post_type(); } elseif ( is_404() ) { $template = '404.twig'; $context['page'] = '404'; } Timber::render( $template, $context );