Castlegate IT WP Breadcrumb WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
Simple breadcrumb navigation for WordPress
Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/castlegateit/cgit-wp-breadcrumb/archive/refs/heads/master.zipCastlegate IT WP Breadcrumb adds a simple breadcrumb navigation to WordPress. The Castlegate\Breadcrumb\Breadcrumb class can generate breadcrumb items as an array of data, an array of HTML links, or a complete breadcrumb navigation:
use Castlegate\Breadcrumb\Breadcrumb;
$crumb = new Breadcrumb();
$foo = $crumb->getItems(); // return array of items
$foo = $crumb->getLinks(); // return array of HTML links
$foo = $crumb->render($sep); // return HTML links separated by $sep
$foo = $crumb->renderList($tag); // return HTML list
Default text for front page and posts page
You can specify the text used for the home page and the posts index in the constructor:
$crumb = new Breadcrumb([
'home' => 'Home',
'index' => 'News',
]);
You can also use the cgit_breadcrumb_names filter to edit the array of front and posts page names.
Custom HTML
You can customize the HTML used for links, non-links, and the current breadcrumb item using a filter, with sprintf strings as templates:
add_filter('cgit_breadcrumb_templates', function ($templates) {
'url' => '<a href="%2$s" class="cgit-breadcrumb-item link">%1$s</a>',
'current' => '<span class="cgit-breadcrumb-item current">%s</span>',
'span' => '<span class="cgit-breadcrumb-item span">%s</span>',
});
Functions
For backwards compatibility, the plugin also provides a function for rendering a breadcrumb navigation, equivalent to the render method:
$foo = cgit_breadcrumb($sep, $home, $index);
License
Released under the MIT License. See LICENSE for details.
Releases
2 releases.
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.