/** * Retrieve the items, found by this locator. * * @access public * * @param int $priority The priority of the located items. * @param int $user_id The author user ID. * @return array $items The items, found by this locator. */ public function get_items($priority = 1000, $user_id = 0) { // get the current author ID, if not specified if (!$user_id) { $user_id = get_queried_object_id(); } // create the author breadcrumb item $item = Carbon_Breadcrumb_Item::factory($this->get_type(), $priority); $item->set_id($user_id); $item->setup(); return array($item); }
/** * Retrieve the items, found by this locator. * * @access public * * @param int $id The object ID, used to go up the item tree. * @param int $priority The priority of the located items. * @return array $items The items hierarchy. */ public function get_item_hierarchy($id, $priority) { $items = array(); do { $item = Carbon_Breadcrumb_Item::factory($this->get_type(), $priority); $item->set_id($id); $item->set_subtype($this->get_subtype()); $item->setup(); $items[] = $item; $id = $this->get_parent_id($id); } while ($id); return array_reverse($items); }
/** * Retrieve the items, found by this locator. * * @access public * * @param int $priority The priority of the located items. * @param int $id Not used. * @return array $items The items, found by this locator. */ public function get_items($priority = 1000, $id = 0) { $items = array(); // prepare the date archive item details $date_archives = $this->get_archive_item_details(); // add the associated date archive breadcrumb items foreach ($date_archives as $archive_name => $archive_details) { if ($archive_details['condition']) { $item = Carbon_Breadcrumb_Item::factory('custom', $priority); $item->set_title(get_the_time($archive_details['title_format'])); $item->set_link($archive_details['link']); $item->setup(); $items[] = $item; } } return $items; }
/** * Add a custom breadcrumb item to the trail. * * @access public * * @param string $title Breadcrumb item title. * @param string $link Breadcrumb item link. * @param int $priority Breadcrumb item priority. */ public function add_custom_item($title, $link = '', $priority = 1000) { $custom_item = Carbon_Breadcrumb_Item::factory('custom', $priority); $custom_item->set_title($title); $custom_item->set_link($link); $custom_item->setup(); $this->add_item($custom_item); }