Search by

arraypress / wp-breadcrumbs

arraypress

This package is abandoned and no longer maintained. No replacement package was suggested.

A lightweight fluent builder for generating accessible HTML breadcrumb navigation with Schema.org microdata, ARIA attributes, and WordPress admin support.

Package info

github.com/arraypress/wp-breadcrumbs

pkg:composer/arraypress/wp-breadcrumbs

Statistics

Installs: 479

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-25 15:44 UTC

This package is auto-updated.

Last update: 2026-11-18 10:50:50 UTC


README

This library has moved. It is now part of sugarcommerce/breadcrumbs (namespace SugarCommerce\Breadcrumbs, PHP 8.3+). That package's README has a "Moving from arraypress/wp-*" table. This repository is archived and read-only.

Breadcrumbs

Build a breadcrumb trail that search engines can read and screen readers can navigate.

What it does

Breadcrumbs look like a list of links until you need them done properly: a <nav> with a label, the current page marked with aria-current rather than just styled differently, and Schema.org microdata so Google shows the trail in results instead of a bare URL.

This builds that markup from the items you add, so the accessibility and the structured data come for free rather than being remembered.

Features

  • Build a trail by adding items, with the current page marked correctly
  • Get Schema.org BreadcrumbList microdata without writing any of it
  • Mark the current item with aria-current, not just a CSS class
  • Add an icon to any item: a Heroicon, a Dashicon, or your own markup
  • Set your own classes on the nav, the list, the items and the separator
  • Render from an array, when the trail is already assembled elsewhere

Installation

composer require arraypress/wp-breadcrumbs

Quick start

use ArrayPress\Breadcrumbs\Breadcrumbs;

Breadcrumbs::create()
	->add( 'Home', '/', 'heroicons-outline:home' )
	->add( 'Products', '/products/' )
	->add_current( 'Widget Pro' )
	->display();

add_current() rather than a third add() — the last crumb is the page you are on, so it is not a link and is announced as the current one.

When the trail already exists as data:

echo render_breadcrumbs( [
	[ 'label' => 'Home', 'url' => '/' ],
	[ 'label' => 'Blog', 'url' => '/blog/' ],
	[ 'label' => 'This post' ],
] );

Icons

The third argument to add(), add_home() and add_current(), and the icon key of an item array, takes any of:

  • set:name -- heroicons-outline:home, heroicons-solid:folder -- drawn as inline SVG in currentColor, 20 by 20, aligned as a Dashicon is
  • a Dashicons name, bare or as the class -- admin-home or dashicons-admin-home -- drawn as the font's span, as before
  • anything else, printed as given (raw HTML, so never untrusted input)

Both named forms carry the class arraypress-icon, so one rule sizes either:

.my-trail .arraypress-icon { width: 16px; height: 16px; font-size: 16px; }

set:name icons are drawn by arraypress/wp-field-kit, which is suggested rather than required. Without it a Dashicons name still draws and a set:name icon draws nothing.

Requirements

  • PHP 8.3 or later
  • WordPress 7.1 or later
  • arraypress/wp-field-kit (optional), for set:name icons

License

GPL-2.0-or-later