Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 public function renderedContent()
 {
     return RenderedContent::get();
 }
Exemplo n.º 3
0
 public function includeTemplate($original_template)
 {
     if (RenderedContent::hasRendered()) {
         if (RenderedContent::endIt()) {
             RenderedContent::endFlush();
             return '';
         } else {
             return $this->getTemplate($original_template);
         }
     } else {
         return $original_template;
     }
 }