Beispiel #1
0
 /**
  * Setter method.
  * Determine if the loop is for a single entity or not. Sets up the appropriate variables.
  *
  * @param boolean $remove
  */
 public function set_single($remove = FALSE)
 {
     if ($remove) {
         $this->is_single = FALSE;
         $this->single_id = NULL;
         return;
     }
     if (!self::$seo_endpoint) {
         self::$seo_endpoint = self::$config->get('seo_endpoint');
     }
     if ($this->request("inventory_id")) {
         $this->single_id = $this->request("inventory_id");
     } else {
         global $wp_query;
         if (isset($wp_query->query_vars[self::$seo_endpoint])) {
             $args = array('inventory_slug' => $wp_query->query_vars[self::$seo_endpoint]);
             $item = $this->item->get_all($args);
             if ($item) {
                 $this->single_id = $item[0]->inventory_id;
             }
         }
     }
     $this->is_single = $this->single_id ? TRUE : FALSE;
 }