PHPackages                             italystrap/breadcrumbs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. italystrap/breadcrumbs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

italystrap/breadcrumbs
======================

ItalyStrap Breadcrumbs Class

2.0.1(5y ago)2279MITPHPPHP &gt;=7.2

Since Nov 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ItalyStrap/breadcrumbs)[ Packagist](https://packagist.org/packages/italystrap/breadcrumbs)[ RSS](/packages/italystrap-breadcrumbs/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (24)Versions (12)Used By (0)

ItalyStrap Breadcrumbs
======================

[](#italystrap-breadcrumbs)

[![License](https://camo.githubusercontent.com/4d2c5141312077a84c333ebb6fc20de723976629f2be00aa09dc5e021e535b21/68747470733a2f2f706f7365722e707567782e6f72672f6974616c7973747261702f62726561646372756d62732f6c6963656e7365)](https://packagist.org/packages/italystrap/breadcrumbs)[![Latest Stable Version](https://camo.githubusercontent.com/17fd8fd110df2763609c3226c9980abdc6925eb9b09d09402e9af2ee35dafcc4/68747470733a2f2f706f7365722e707567782e6f72672f6974616c7973747261702f62726561646372756d62732f762f737461626c65)](https://packagist.org/packages/italystrap/breadcrumbs)[![Codacy Badge](https://camo.githubusercontent.com/6c2ec2334a99cceabadb551b2d1d30b58f53942899eb139a98b0d69155e2ec19/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f6362666636656335343766663432653861653063613364303139353631326431)](https://www.codacy.com/app/overclokk/breadcrumbs?utm_source=github.com&utm_medium=referral&utm_content=ItalyStrap/breadcrumbs&utm_campaign=Badge_Grade)[![Build Status](https://camo.githubusercontent.com/4cda2a30e46e8f453f2d20ce02a8a95f2ff9aef160ad8dee3a8d5e008278d560/68747470733a2f2f7472617669732d63692e6f72672f4974616c7953747261702f62726561646372756d62732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ItalyStrap/breadcrumbs)

Breadcrumbs Class API for WordPress

This package create an HTML or Json Breadcrumbs elements to display on your WordPress site

Installation
------------

[](#installation)

### Install with Composer

[](#install-with-composer)

Add the package to your projects `composer.json` file. Visit [getcomposer.org](http://getcomposer.org/) more information.

```
composer require italystrap/breadcrumbs
```

or

```
{
    "require": {
        "italystrap/breadcrumbs": "dev-master"
    }
}
```

### Install Manually

[](#install-manually)

Download and include the class file into your theme/plugin:

```
include_once 'path/to/ItalyStrap/Breadcrumbs.php';
```

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

Use `\ItalyStrap\Breadcrumbs\Breadcrumbs_Factory::make( $type, $args )` to display the breadcrumbs in your template.

```
use ItalyStrap\Breadcrumbs;

echo Breadcrumbs_Factory::make( 'html', $args );

// Or

echo Breadcrumbs_Factory::make( 'json', $args );
```

The first parameter is the type of breadcrumbs you want to display:

- **HTML**
    - Return the HTML output
- **Json**
    - Return the Json output
- **object**
    - Return the object output
- **array**
    - Return the array output

Options
-------

[](#options)

An optional array of arguments can be passed to modify the breadcrumb output. The defaults for each option @see `Breadcrumbs/config/breadcrumbs.php`

```
/**
 * Default configuration for Breadcrumbs
 */
return [

	/**
	 * This is the container of the breadcrumbs
	 * @example ...
	 */
	'container_tag'				=> 'nav',
	'container_attr'			=> [
		'aria-label'	=> 'breadcrumb',
	],

	/**
	 * This is the list tag of the breadcrumbs
	 * @example ...
	 */
	'list_tag'					=> 'ol',
	'list_attr'					=> [
		'class'			=> 'breadcrumb',
		'itemscope'		=> true,
		'itemtype'		=> 'https://schema.org/BreadcrumbList',
	],

	/**
	 * This is the item tag of the breadcrumbs
	 * @example ...
	 */
	'item_tag'					=> 'li',
	'item_attr'					=> [
		'class'			=> "breadcrumb-item",
		'itemprop'		=> 'itemListElement',
		'itemscope'		=> true,
		'itemtype'		=> 'https://schema.org/ListItem',
	],
	/**
	 * Css class for active element
	 */
	'item_attr_class_active'	=> ' active',

	/**
	 * It could be passed an HTML icon to show instead of the firt element (home)
	 * @example
	 */
	'home_icon'					=> false,

	/**
	 * Separator for the items
	 * @example ' /'
	 */
	'separator'					=> false,

	/**
	 * Show on front
	 * @default true
	 */
	'show_on_front'				=> true,
];
```

### Default HTML output

[](#default-html-output)

```

				ItalyStrap

				Blog

```

Advanced usage
--------------

[](#advanced-usage)

### Example for HTML version

[](#example-for-html-version)

YOu can copy this snippet in your file breadcrumbs.php and include it in your plugin/theme

```
/**
 * Get the Breadcrumbs
 *
 * @param  array  $args The breadcrumbs arguments.
 *                      @see class Breadcrumbs for more info.
 * @return string       Return the breadcrumbs html.
 */
function get_breadcrumbs( array $args = array() ) {

	$args['bloginfo_name'] = GET_BLOGINFO_NAME;
	$args['home_url'] = HOME_URL;
	$args['separator'] = false;

	$args['show_on_front'] = false;

	try {

		return apply_filters(
			'italystrap_get_the_breadcrumbs',
			\ItalyStrap\Breadcrumbs\Breadcrumbs_Factory::make( 'html', $args ),
			$args
		);

	} catch ( Exception $e ) {
		echo $e->getMessage();
	}
}

/**
 * Print the Breadcrumbs
 *
 * @param  array  $args The breadcrumbs arguments.
 *                      @see class Breadcrumbs for more info.
 * @return string       Return the breadcrumbs html.
 */
function breadcrumbs( array $args = array() ) {

	echo get_breadcrumbs( $args );
}

/**
 * Do breadcrumbs
 *
 * @since 2.2.0
 *
 * @param  array  $args The breadcrumbs arguments.
 */
function do_breadcrumbs( array $args = array() ) {

	breadcrumbs( $args );
}
add_action( 'do_breadcrumbs', __NAMESPACE__ . '\do_breadcrumbs' );
```

Then with the function `do_action( 'do_breadcrumbs', [] )` you can display the breadcrumbs where you want in your theme.

### Example for Json version

[](#example-for-json-version)

```
/**
 * Get the Breadcrumbs
 *
 * @param  array  $args The breadcrumbs arguments.
 *                      @see class Breadcrumbs for more info.
 * @return string       Return the breadcrumbs html.
 */
function get_breadcrumbs( array $args = array() ) {

	$args['bloginfo_name'] = GET_BLOGINFO_NAME;
	$args['home_url'] = HOME_URL;

	$args['show_on_front'] = false;

	try {

		return apply_filters(
			'italystrap_get_the_breadcrumbs',
			\ItalyStrap\Breadcrumbs\Breadcrumbs_Factory::make( 'json', $args ),
			$args
		);

	} catch ( Exception $e ) {
		echo $e->getMessage();
	}
}

/**
 * Print the Breadcrumbs
 *
 * @param  array  $args The breadcrumbs arguments.
 *                      @see class Breadcrumbs for more info.
 * @return string       Return the breadcrumbs html.
 */
function breadcrumbs( array $args = array() ) {

	echo get_breadcrumbs( $args );
}

/**
 * Do breadcrumbs
 *
 * @since 2.2.0
 *
 * @param  array  $args The breadcrumbs arguments.
 */
function do_breadcrumbs( array $args = array() ) {

	breadcrumbs( $args );
}
add_action( 'wp_footer', __NAMESPACE__ . '\do_breadcrumbs' );
```

Filters
-------

[](#filters)

> TODO

Other Example
-------------

[](#other-example)

> TODO

array\_insert()
---------------

[](#array_insert)

`array_insert()` is a function that allows you to insert a new element into an array at a specific index.

### Example array\_insert()

[](#example-array_insert)

```
/**
 * Modify breadcrums list
 *
 * @param  {array} $list
 *
 * @return {array}
 */
function modify_breadcrumbs_list( array $list ) {

    // if on the events category archive page
    if( is_tax( 'event-categories' ) ) {

        // create a new element
        $element = [
            'title'	=> "Shows",
            'url'	=> site_url( '/shows' )
        ];

        // add the new element at the index of 1
        $list = array_insert( $list, $element, 1 );
    }

    return $list;
}

add_filter( 'ItalyStrap\Breadcrumbs\Container\Items', 'modify_breadcrumbs_list' );
```

Notes
-----

[](#notes)

- Licensed under the [GNU General Public License v2.0](https://github.com/ItalyStrap/breadcrumbs/blob/master/LICENSE)
- Maintained under the [Semantic Versioning Guide](http://semver.org)

Author
------

[](#author)

**Enea Overclokk**

-

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Recently: every ~157 days

Total

11

Last Release

2090d ago

Major Versions

1.1.4 → 2.0.02019-04-02

PHP version history (2 changes)1.0.0PHP ^5.3 || ^5.4 || ^5.5 || ^5.6 || ^7.0

2.0.1PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/13d145319a065be260ee79e728655780ddd63002e5ac6c317701c8996ec8d94c?d=identicon)[overclokk](/maintainers/overclokk)

---

Top Contributors

[![overclokk](https://avatars.githubusercontent.com/u/4604932?v=4)](https://github.com/overclokk "overclokk (44 commits)")

---

Tags

wordpressbreadcrumbs

###  Code Quality

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/italystrap-breadcrumbs/health.svg)

```
[![Health](https://phpackages.com/badges/italystrap-breadcrumbs/health.svg)](https://phpackages.com/packages/italystrap-breadcrumbs)
```

###  Alternatives

[tgmpa/tgm-plugin-activation

TGM Plugin Activation is a PHP library that allows you to easily require or recommend plugins for your WordPress themes (and plugins).

1.8k222.5k13](/packages/tgmpa-tgm-plugin-activation)[aristath/kirki

Extending the WordPress customizer

1.3k73.0k4](/packages/aristath-kirki)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.6k](/packages/afragen-git-updater)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
