Breadcrumb_Trail

Creates a breadcrumbs menu for the site based on the current page that’s being viewed by the user.


Package


Description Description



Top ↑

Methods Methods

  • __construct — Sets up the breadcrumb trail properties. Calls the `Breadcrumb_Trail::add_items()` method to creat the array of breadcrumb items.
  • __toString — Magic method to use in case someone tries to output the layout object as a string.
  • add_404_items — Adds the items to the trail items array for 404 pages.
  • add_blog_items — Adds items for the posts page (i.e., is_home()) to the items array.
  • add_day_archive_items — Adds the items to the trail items array for day archives.
  • add_default_archive_items — Adds the items to the trail items array for archives that don't have a more specific method defined in this class.
  • add_front_page_items — Adds items for the front page to the items array.
  • add_hour_archive_items — Adds the items to the trail items array for hour archives.
  • add_items — Runs through the various WordPress conditional tags to check the current page being viewed. Once a condition is met, a specific method is launched to add items to the `$items` array.
  • add_minute_archive_items — Adds the items to the trail items array for minute archives.
  • add_minute_hour_archive_items — Adds the items to the trail items array for minute + hour archives.
  • add_month_archive_items — Adds the items to the trail items array for month archives.
  • add_network_home_link — Adds the network (all sites) home page link to the items array.
  • add_paged_items — Adds the page/paged number to the items array.
  • add_path_parents — Get parent posts by path. Currently, this method only supports getting parents of the 'page' post type. The goal of this function is to create a clear path back to home given what would normally be a "ghost" directory. If any page matches the given path, it'll be added.
  • add_post_hierarchy — Adds a specific post's hierarchy to the items array. The hierarchy is determined by post type's rewrite arguments and whether it has an archive page.
  • add_post_parents — Adds a specific post's parents to the items array.
  • add_post_terms — Adds a post's terms from a specific taxonomy to the items array.
  • add_post_type_archive_items — Adds the items to the trail items array for post type archives.
  • add_rewrite_front_items — Gets front items based on $wp_rewrite->front.
  • add_search_items — Adds the items to the trail items array for search results.
  • add_singular_items — Adds singular post items to the items array.
  • add_site_home_link — Adds the current site's home page link to the items array.
  • add_term_archive_items — Adds the items to the trail items array for taxonomy term archives.
  • add_term_parents — Searches for term parents of hierarchical taxonomies. This function is similar to the WordPress function get_category_parents() but handles any type of taxonomy.
  • add_user_archive_items — Adds the items to the trail items array for user (author) archives.
  • add_week_archive_items — Adds the items to the trail items array for week archives.
  • add_year_archive_items — Adds the items to the trail items array for year archives.
  • get_post_types_by_slug — Gets post types by slug. This is needed because the get_post_types() function doesn't exactly match the 'has_archive' argument when it's set as a string instead of a boolean.
  • map_rewrite_tags — Turns %tag% from permalink structures into usable links for the breadcrumb trail. This feels kind of hackish for now because we're checking for specific %tag% examples and only doing it for the 'post' post type. In the future, maybe it'll handle a wider variety of possibilities, especially for custom post types.
  • set_labels — Sets the labels property. Parses the inputted labels array with the defaults.
  • set_post_taxonomy — Sets the `$post_taxonomy` property. This is an array of post types (key) and taxonomies (value).
  • trail — Formats the HTML output for the breadcrumb trail.
Premium WordPress Apps

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.