Skip to content

Breadcrumbs

Ben Gillbanks edited this page Aug 30, 2019 · 7 revisions

Display breadcrumbs on your posts, and categories.

This module needs two things to work:

  1. It needs to be enabled in the Toolbelt Settings
  2. It needs to be implemented in the theme.

Why enabled in the settings AND implemented in the theme?

To keep speed high, Toolbelt only includes code for enabled modules. The breadcrumbs only work when the tb_breadcrumbs function is called, but the function will not exist without the module being enabled.

In addition, by having a setting; themes that add support for breadcrumbs can still disable them whilst using other Toolbelt features.

Implementation

To add to a theme I would suggest creating a new template function that looks something like:

function my_theme_breadcrumbs() {
    if ( function_exists( 'tb_breadcrumbs' ) ) {
        tb_breadcrumbs();
    }
}

This reduces the likelihood of things breaking. If Toolbelt gets deleted, or the module disabled, then no errors will appear and the site will continue to work.

Clone this wiki locally