How to Add a Custom Breadcrumb Template Tag

Since version 4.4.0, it has been possible to add additional custom template tags to supplement the defaults included in Breadcrumb NavXT. Adding a custom template tag is relatively easy. All one has to do is write a function that hooks into the bcn_template_tags filter and adds the new template tag.

bcn_template_tags has three parameters, two for helping identify the resource the breadcrumb represents, and one for the actual replacement set. Today, we’ll focus on the first parameter, the $replacements array. This associative array has the template tag as the key and the value is the actual value that should replace the tag in breadcrumbs. To add a new template tag, simply add a new key-value pair to the array and return the modified $replacements array.

For example, to add a breadcrumb template tag that inserts the current theme’s directory, one could use the following:

function my_bcn_template_tag($replacements, $type, $id)
{
    //Add the %template_directory% template tag
    $replacements['%template_directory%'] = get_bloginfo('template_directory');
    //Return our new set of templates and replacements
    return $replacements;
}
add_filter('bcn_template_tags', 'my_bcn_template_tag', 3, 10);

In the code above, %template_directory% is the breadcrumb template tag being added; its value is retrieved using the get_bloginfo() function. Simple, right?

-John Havlik

[end of transmission, stay tuned]

Breadcrumb NavXT Paths 1.0.0

Introducing Breadcrumb NavXT Paths. This plugin adds support for “structured” path breadcrumb trails. The user path to a post with multiple terms in the same taxonomy will influence the terms displayed in the breadcrumb trail. As the the successor of Order Bender, it also features the ability to specify a preferred term when a post is a member of multiple terms within a taxonomy.

Features

  • Automatically selects the term hierarchy for a post based off of the user’s previously visited term archive
  • Supports picking the term based off of the “Preferred” term for the post in Yoast SEO
  • Includes “Preferred Term” metabox in the post editor for setting the preferred term if none of the supported SEO plugins are active

-John Havlik

[end of transmission, stay tuned]

Breadcrumb NavXT Menu Magic 1.1.1

Announcing the immediate availability of Breadcrumb NavXT Menu Magic 1.1.1. This version adds compatibility with the forthcoming Breadcrumb NavXT 5.5.0. Additionally, it fixes a bug with the title finding logic that could result in the selection of an incorrect title if a filter using the_title prevented blank titles from being returned by get_the_title().

Users with valid and activated license keys should receive an update notification within the WordPress dashboard and be able to use the update mechanism to update (just like with any plugin in the WordPress.org repository).

-John Havlik

[end of transmission, stay tuned]

Order Bender 0.7.2

Introducing Order Bender 0.7.2. This version fixes two bugs in the previous release, 0.7.0. These bugs relate to cases when a preferred term had not been selected for a post. Previously, it was possible to cause Breadcrumb NavXT to throw an error if a preferred category was not set due to improperly handling this case by the new code taking advantage of the new bcn_pick_post_term filter in Breadcrumb NavXT 5.4.0.

Installation is quite easy:

  1. Download the Master branch zip archive from GitHub
  2. In your WordPress Dashboard navigate to the plugin uploader (Plugins > Add New > Upload)
  3. Upload the zip archive
  4. Activate and enjoy!

You can keep up with day to day development via the Order Bender’s GitHub Repository.

-John Havlik

[end of transmission, stay tuned]

Breadcrumb NavXT Title Trixx 1.2.0

Announcing the immediate availability of Breadcrumb NavXT Title Trixx 1.2.0. This version introduces support for alternate title for terms of any taxonomy. Additionally, this version contains a couple under-the-hood code  improvements centered around receiving plugin updates.

Users with valid and activated license keys should receive an update notification within the WordPress dashboard and be able to use the update mechanism to update (just like with any plugin in the WordPress.org repository).

-John Havlik

[end of transmission, stay tuned]