function rendez_vous_get_the_type() { if (!rendez_vous_has_types()) { return false; } $types = rendez_vous_get_type(rendez_vous_get_the_rendez_vous_id()); if (empty($types)) { return false; } $type_names = wp_list_pluck($types, 'name'); $type_name = array_pop($type_names); $type_slugs = wp_list_pluck($types, 'slug'); $type_slug = array_pop($type_slugs); $output = sprintf('<div class="item-desc"><a href="?type=%s" title="%s" class="rendez-vous-type">%s</a></div>', esc_attr($type_slug), esc_attr__('Filter rendez-vous having this type', 'rendez-vous'), esc_html($type_name)); return apply_filters('rendez_vous_get_the_type', $output, $type_name, $type_slug); }
/** * request an item id * * @uses get_post() */ public function populate() { $rendez_vous = get_post($this->id); if (is_a($rendez_vous, 'WP_Post')) { $this->id = $rendez_vous->ID; $this->organizer = $rendez_vous->post_author; $this->title = $rendez_vous->post_title; $this->venue = get_post_meta($rendez_vous->ID, '_rendez_vous_venue', true); $this->type = rendez_vous_get_type($rendez_vous->ID); $this->description = $rendez_vous->post_excerpt; $this->duration = get_post_meta($rendez_vous->ID, '_rendez_vous_duration', true); $this->privacy = 'draft' == $rendez_vous->post_status ? get_post_meta($rendez_vous->ID, '_rendez_vous_status', true) : $rendez_vous->post_status; $this->status = $rendez_vous->post_status; $this->days = get_post_meta($rendez_vous->ID, '_rendez_vous_days', true); $this->attendees = get_post_meta($this->id, '_rendez_vous_attendees'); $this->report = $rendez_vous->post_content; $this->older_date = false; if (!empty($this->days)) { $timestamps = array_keys($this->days); rsort($timestamps); $this->older_date = date_i18n('Y-m-d H:i:s', $timestamps[0]); } $this->def_date = get_post_meta($rendez_vous->ID, '_rendez_vous_defdate', true); $this->modified = $rendez_vous->post_modified; $this->group_id = get_post_meta($rendez_vous->ID, '_rendez_vous_group_id', true); } }