/**
  * Overrides global $post and $wp_query with the rendered content from CloudLess.
  * Its done if is_main_query and CloudLess detected a correct and matching route.
  */
 public function override()
 {
     global $wp_query;
     if ($wp_query->is_main_query() && !$this->routes->isRouted() || !$wp_query->is_main_query() && !$this->routes->isRouted() || !$wp_query->is_main_query() && $this->routes->isRouted()) {
         return;
     }
     $bag = Container::instance()->fetch('Bag');
     $args = ['post_content' => RenderedContent::get(), 'post_title' => $bag->title, 'is_page' => true, 'guid' => $this->routes->getCurrentRoute()->getRoutePath()];
     $dummy = new DummyPost($args);
     $dummy->overrideWpQuery();
     remove_filter('the_content', 'wpautop');
     unset($dummy);
 }
Beispiel #2
0
 /**
  * @param $handle
  * @return bool
  */
 public function disable404handling($handle)
 {
     if ($this->routes->isRouted()) {
         return false;
     }
     return $handle;
 }