public function __construct($id = null, $hotel_id = null) { if (is_int($id)) { parent::__construct($id); $resrv = get_post($id); $hotel = new Hotel($hotel_id); if (is_object($resrv)) { $this->reservation_id = $resrv->ID; } } }
public function __construct($id = null) { if (is_int($id)) { parent::__construct($id); $hotel = get_post($id); if (is_object($hotel)) { $terms = wp_get_post_terms($hotel->ID, 'hotel-category'); $this->hotel_id = $hotel->ID; $this->hotel_name = $hotel->post_title; $this->hotel_slug = $hotel->post_name; $this->hotel_description = $hotel->post_content; $this->hotel_type = $terms[0]->name; $this->hotel_type_id = $terms[0]->term_id; } } }