public static function print_wp($route) { if (!defined('ABSPATH')) { return; } Page::get_instance()->route = $route; add_filter('template_include', array(__CLASS__, 'wipe_template'), 1); }
return $template; } /** * Fires before determining which template to load, * executing any custom template redirections. * * @used-by Action: 'template_redirect' * * @todo Remove this condition from 'redirection-child': `$post->post_parent === 0`. */ public function template_redirect() { if (!is_admin() && is_page()) { global $post; $post->template = get_post_meta($post->ID, '_wp_page_template', true); if (isset($this->templates[$post->template])) { if ('redirection-child' === $post->template) { $destination = get_children(['numberposts' => 1, 'post_parent' => $post->ID, 'post_type' => 'page', 'post_status' => 'publish', 'orderby' => 'menu_order', 'order' => 'ASC']); } if ('redirection-parent' === $post->template && $post->post_parent > 0) { $destination = get_post($post->post_parent); } if (1 == count($destination) && wp_redirect(get_permalink(current($destination)->ID), 301)) { exit; } } } } } Page::get_instance();
<?php namespace WoR; Template::print_body(Page::get_instance()->route);