Ejemplo n.º 1
0
 /**
  * Exection hook
  *
  * @param Stencil_Interface $controller Controller that initiated this class.
  */
 public function execute(Stencil_Interface $controller)
 {
     $object = get_queried_object();
     if (class_exists('Taxonomy', false)) {
         $controller->set('taxonomy', Taxonomy::get($object->taxonomy));
     } else {
         $controller->set('taxonomy', $object);
     }
 }
Ejemplo n.º 2
0
 /**
  * Exection hook
  *
  * @param Stencil_Interface $controller Controller that initiated this class.
  */
 public function execute(Stencil_Interface $controller)
 {
     $controller->set('author_display_name', get_the_author());
     $object = get_queried_object();
     if (class_exists('User', false)) {
         $controller->set('author', User::get($object->ID));
     } else {
         $controller->set('author', $object);
     }
 }
Ejemplo n.º 3
0
 /**
  * Exection hook
  *
  * @param Stencil_Interface $controller Controller that initiated this class.
  */
 public function execute(Stencil_Interface $controller)
 {
     $list = array();
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             $object = get_post();
             /**
              * Respect post_as_object filter
              */
             $post_as_object = Stencil_Environment::filter('post_as_object', true);
             if ($post_as_object) {
                 /**
                  * Apply fancy Human Made Post object if loaded
                  */
                 if (class_exists('Post', false)) {
                     $item = Post::get($object->ID);
                 } else {
                     $item = $object;
                 }
             } else {
                 $item = (array) $object;
             }
             // Add item to the list.
             $list[] = $item;
             // Clean up.
             unset($item);
         }
     }
     wp_reset_postdata();
     $controller->set('posts', $list);
 }
Ejemplo n.º 4
0
 /**
  * Exection hook
  *
  * @param Stencil_Interface $controller Controller that initiated this class.
  */
 public function execute(Stencil_Interface $controller)
 {
     $url = (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $controller->set('self', $url);
     // Loading post(s) as object or array.
     $post_as_object = Stencil_Environment::filter('post_as_object', true);
     $object = get_queried_object();
     if ($object && is_a($object, 'WP_Post')) {
         /**
          * Filter to chose whether the 'post' variable is set as array or object
          */
         if ($post_as_object) {
             if (class_exists('Post', false)) {
                 $controller->set('post', Post::get($object->ID));
             } else {
                 $controller->set('post', $object);
             }
         } else {
             $controller->set('post', (array) $object);
         }
         // Additional handy variables.
         $controller->set('id', $object->ID);
         $controller->set('post_type', get_post_type($object));
     }
 }
Ejemplo n.º 5
0
 /**
  * Exection hook
  *
  * @param Stencil_Interface $controller Controller that initiated this class.
  */
 public function execute(Stencil_Interface $controller)
 {
     $controller->set('search', get_search_query(true));
 }
Ejemplo n.º 6
0
 /**
  * Exection hook
  *
  * @param Stencil_Interface $controller Controller that initiated this class.
  */
 public function execute(Stencil_Interface $controller)
 {
     $category = array('id' => get_query_var('cat'), 'name' => get_cat_name(get_query_var('cat')), 'title' => single_cat_title('', false), 'description' => term_description());
     $controller->set('category', $category);
 }
Ejemplo n.º 7
0
 /**
  * Exection hook
  *
  * @param Stencil_Interface $controller Controller that initiated this class.
  */
 public function execute(Stencil_Interface $controller)
 {
     $controller->set('tag', single_tag_title('', false));
 }
Ejemplo n.º 8
0
 /**
  * Exection hook
  *
  * @param Stencil_Interface $controller Controller that initiated this class.
  */
 public function execute(Stencil_Interface $controller)
 {
     $controller->set('post_type', get_post_type());
 }