Breadcrumb Trail is a plugin that displays a breadcrumb menu on your site. Plain and simple.
How is it any better than any other breadcrumb plugin? Well, it's probably not, to be perfectly honest. This is just a script I've been building upon for nearly a couple of years that I usually include with my WordPress themes. I figured I'd package it as a plugin for others to use as well.
breadcrumb-trail.zip
folder.breadcrumb-trail
folder to your /wp-content/plugins
directory.This plugin won't work automatically because there's no way for me to know where it should show within your theme. So, you'll have to add it manually in your template files. Where? Well, that's really up to you. You can add it pretty much anywhere you want.
This is the basic code:
<?php breadcrumb_trail(); ?>
By default, this plugin is designed to show things a certain way. Here are the defaults:
$defaults = array(
'separator' => '/',
'before' => '<span class="breadcrumb-title">' . __('Browse:', 'breadcrumb_trail') . '</span>',
'after' => false,
'front_page' => true,
'show_home' => __('Home', 'breadcrumb_trail'),
'echo' => true,
);
false
if no home link is needed.Let's change the text before the breadcrumb trail.
<?php breadcrumb_trail( array( 'before' => 'You are here »' ) ); ?>
How about we change the separator between each item?
<?php breadcrumb_trail( array( 'separator' => '→' ) ); ?>
This time, we'll wrap the entire menu in brackets.
<?php breadcrumb_trail( array( 'before' => '{', 'after' => '}' ) ); ?>
Pretty simple stuff, right? Just mix and match the parameters however you want.
Sometimes, we stop using plugins, but we forget to remove the function calls to the plugins in our theme files. When deactivated, this causes errors. To protect yourself from these errors, you can call the breadcrumb trail like this:
<?php if ( function_exists( 'breadcrumb_trail' ) ) { breadcrumb_trail(); } ?>
Basically, this just checks to see if the plugin is activated and has loaded the appropriate function.
Breadcrumb Trail comes with some extra classes to work with, so you can have a bit of freedom when styling your menu. Here are the CSS classes for your use:
.breadcrumb {
/* This is the outer 'div' you can style */
}
.breadcrumb-trail {
/* This is the inner 'div' you can style */
}
If you're a theme developer, you can always add checks for this plugin and place it yourself within your template files or use add_action()
to add it to a custom theme hook.
This plugin has two filter hooks for use as well:
I run a WordPress community called Theme Hybrid, which is where I fully support all of my WordPress projects, including plugins. You can sign up for an account to get plugin support for a small yearly fee ($25 USD at the time of writing).
I know. I know. You might not want to pay for support, but just consider it a donation to the project. To continue making cool, GPL-licensed plugins and having the time to support them, I must pay the bills.
Breadcrumb Trail is licensed under the GNU General Public License, version 2 (GPL).
This plugin is copyrighted to Justin Tadlock.
2008 – 2010 © Justin Tadlock. All rights reserved.