public function __construct(Context $context, $template = null) { parent::__construct($context, $template); global $wp_query; if ($wp_query->post) { $this->post = $context->modelForPost($wp_query->post); } }
public function __construct(Context $context, $template = null) { parent::__construct($context, $template); global $wp_query; if ($wp_query->post) { $post = $context->modelForPost($wp_query->post); if ($post instanceof Page) { $this->page = $post; $context->cacheControl->setCacheControlHeadersForPage($this->page->id); } } }
public function __construct(Context $context, $template = null) { parent::__construct($context, $template); global $wp_query; if ($wp_query->post && $wp_query->post->post_type == 'page') { $this->page = $context->modelForPost($wp_query->post); $context->cacheControl->setCacheControlHeadersForPage($this->page->id); } $this->totalPosts = $wp_query->found_posts; $this->currentPage = $wp_query->query_vars['paged'] ?: 1; foreach ($wp_query->posts as $post) { $this->posts[] = $this->context->modelForPost($post); } }
public function __construct(Context $context, $template = null) { parent::__construct($context, $template); }