Carbon Breadcrumbs

Plugin Banner

Carbon Breadcrumbs

by Marin Atanasov

Download
Description

Provides the theme and plugin developers an easy way to build and implement highly customizable breadcrumb functionality, specifically tailored to their needs.
Supports a lot of filters and hooks, and is written in OOP style, giving developers full control over the breadcrumb trail items and appearance.
This plugin can also be embedded in themes, instead of installing it as a WordPress plugin.

Configuration

The most basic way to insert Carbon Breadcrumbs in your theme code is:

<?php Carbon_Breadcrumb_Trail::output(); ?>

If you want to specify various breadcrumb rendering options, you can specify them in an array, like this:

<?php
Carbon_Breadcrumb_Trail::output(array(
    'glue' => ' &gt; ', // glue between breadcrumb items
    'link_before' => '',
    'link_after' => '',
    'wrapper_before' => '',
    'wrapper_after' => '',
    'title_before' => '',
    'title_after' => '',
    'min_items' => 2,
    'last_item_link' => true,
    'display_home_item' => true,
    'home_item_title' => __('Home', 'carbon_breadcrumbs'),
    'renderer' => 'Carbon_Breadcrumb_Trail_Renderer',
));
?>

For additional configuration and developer documentation, you can visit the Github repository:

https://github.com/tyxla/carbon-breadcrumbs

Ideas and bug reports

Any ideas for new modules or any other additional functionality that users would benefit from are welcome.

If you have an idea for a new feature, or you want to report a bug, feel free to do it here in the Support tab, or you can do it at the Github repository of the project:

https://github.com/tyxla/carbon-breadcrumbs

  1. Install Carbon Breadcrumbs either via the WordPress.org plugin directory, or by uploading the files to your server.
  2. Activate the plugin.
  3. That’s it. You’re ready to go! Please, refer to the Configuration section for examples and usage information.

Really wonderful, well-thought code. wish there were schematags

By gnowland on October 17, 2017

GREAT plugin, fantastic codebase: super clean & TESTED?! FTW! Only downside is no schematagging out of the box :/. This is a pivotal SEO feature and I think this would greatly boost interest in your plugin. Info: https://developers.google.com/search/docs/data-types/breadcrumbs#guidelines Result should look like:

<ol itemscope itemtype="http://schema.org/BreadcrumbList">
  <li itemprop="itemListElement" itemscope
      itemtype="http://schema.org/ListItem">
    <a itemscope itemtype="http://schema.org/WebPage"
       itemprop="item" href="link.html">
        <span itemprop="name">Crumb 1</span>
    </a>
    <meta itemprop="position" content="1" />
/
  </li>
  <li itemprop="itemListElement" itemscope
      itemtype="http://schema.org/ListItem">
    <a itemscope itemtype="http://schema.org/WebPage"
       itemprop="item" href="link2.html">
        <span itemprop="name">Crumb 2</span>
    </a>
    <meta itemprop="position" content="2" />
  </li>
</ol>
Here's how I've shimmed it in:

<?php
  $breadcrumbs = new Carbon_Breadcrumb_Trail(array(
    'glue' => ' / ',
    'link_before' => '<li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">',
    'link_after' => '</li>',
    'wrapper_before' => '<ol class="breadcrumbs" itemscope itemtype="http://schema.org/BreadcrumbList">',
    'wrapper_after' => '</ol>',
    'title_before' => '<span itemprop="name">',
    'title_after' => '</span>',
  ));

  $breadcrumbs->setup();
  echo $breadcrumbs->render(true); // WP_KSES strips itemprop, itemscope, etc, so bypassing!!!

  add_filter('carbon_breadcrumbs_item_attributes', _'breadcrumb_schematags', 10, 2);
  function breadcrumb_schematags($attributes, $item) {
    if (!is_array($attributes)) $attributes = array();
    $attributes['itemscope'] = null;
    $attributes['itemtype'] = 'http://schema.org/WebPage';
    $attributes['itemprop'] = 'item';
    return $attributes;
  }
  add_filter('carbon_breadcrumbs_item_output', 'breadcrumb_item_position', 10, 5);
  function breadcrumb_item_position($item_output, $item, $trail, $trail_renderer, $index){
    // Add Position
    $n = strrpos($item_output, '</li>');
    $item_output = substr($item_output, 0, $n)  . '<meta itemprop="position" content="'. $index .'" />' . substr($item_output, $n);
    return $item_output;
  }

Fab for Woocommerce products

By stevehoo on December 6, 2016

The best breadcrumbs plugin I've used

By Marin Atanasov (tyxla) on September 3, 2016

This remains the best breadcrumbs plugin I've used. In addition to its rich customization options, it provides developers with various easy ways to extend it.

Very customizable

By Peter Petrov (ppetrov2c) on December 24, 2016

This plugin has saved me quite some time.

Thanks to the numerous filters, you can adjust everything.

Respect <3

1.0.2

Tested with WordPress 4.5.

1.0.1

Add some .gitattributes to make exporting lighter.

1.0

Initial version.

Back to top