How to Implement RDFa Breadcrumbs with Breadcrumb NavXT

While the Google microformats for Breadcrumbs are verbose, ugly, and deprecated, to date, Google still doesn’t support Schema.org breadcrumbs. Thus, we’re going to have to live with the ugly RDFa format for the time being. While there is no ‘one click’ configuration for RDFa breadcrumbs within Breadcrumb NavXT, support for them is not too difficult to configure.

Calling Code Modifications

To begin, the wrapping div for the calling code needs to have xmlns:v="http://rdf.data-vocabulary.org/#" added to it. Below is an example calling code block for users of the regular bcn_display(); function.

<div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">
    <?php if(function_exists('bcn_display'))
    {
        bcn_display();
    }?>
</div>

Settings Modifications

In general, you need a

<span typeof="v:Breadcrumb">

wrapping around every breadcrumb, and an inner element containing property="v.title" and rel="v:url" if the breadcrumb contains a link. For the most part this will result in two replacements need to be made to all of the breadcrumb templates. For the linked breadcrumb templates, replace:

<a title="Go to %title%." href="%link%">%htitle%</a>

with:

<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" title="Go to %title%." href="%link%" class="%type%">%htitle%</a></span>

Note the extra span containing the typeof declaration. This is necessary for Google to pick up on the breadcrumb objects (even though the tag is redundant as the property should work on the anchor).

For the unlinked breadcrumb templates, replace:

%htitle%

with:

<span typeof="v:Breadcrumb"><span property="v:title">%htitle%</span></span>

To jumpstart this replacement process, you can import the following Breadcrumb NavXT settings XML file. Breadcrumb NavXT RDFa Breadcrumbs settings file (Right click and select “Save As”).

One Last Thing

Depending on the version of Breadcrumb NavXT, the typeof attribute may not be accepted in the settings (it will get automatically stripped out). To fix this follow the process outlined in How to Add li and Other Tags to Breadcrumb Templates to add the typeof attribute to the span HTML tag. Otherwise, wait for Breadcrumb NavXT 5.1 (or 5.0.2) to be released.

-John Havlik

[end of transmission, stay tuned]

Help! I Can’t Save My Settings After Upgrading Breadcrumb NavXT

snapshot6

After upgrading from a version of Breadcrumb NavXT older than 4.2, you may see the following message when attempting to save your Breadcrumb NavXT settings:

Value must be greater than or equal to 1.

This message is caused by the value of “Max Title Length” being less than 1. Some modern web browsers, such as Chrome will display this warning (and in some cases it may appear to come from the admin bar as in the leading screenshot). While, others, such as Firefox, will not (and will not prevent you from saving your settings).

To fix this issue, change the value of “Max Title Length” to be greater than 0. If you do not want your breadcrumb titles to be restricted in length, make sure “Limit the length of the breadcrumb title.” remains unchecked. You should now be able to save your settings.

Some Background

Back in Breadcrumb NavXT 4.2, the breadcrumb “Max Title Length” setting was split into an enable switch for restricting the length of breadcrumb title and a second option for specifying the maximum length. Previously, setting the max breadcrumb title length to 0 was interpreted as disabling the title length trim feature. This was not entire intuitive hence the switch.

When this switch was made, the new “Max Title Length” was changed to the HTML5 number form input element, with a minimum value set to 1. Additionally, Breadcrumb NavXT started shipping with 20 being the default “Max Title Length” value, with the title trim feature turned off by default. Thus, new users of the plugin will never see this issue. Additionally, the next release of Breadcrumb NavXT will have a modification which will not allow Max Title Length to be 0 when a user upgrades versions (will automatically correct it to the new default of 20).

-John Havlik

[end of transmission, stay tuned]

Help! I’m Getting an Error Message After Upgrading Breadcrumb NavXT to 5.0.1

Starting with Breadcrumb NavXT 5.0.1 (and running through the 5.1.x releases) the message below may appear when you update the plugin from a pre 5.0 version (e.g. 4.4):

Breadcrumb NavXT was just updated from a pre-5.0 version, please go to your plugins page and activate “Breadcrumb NavXT”. Also, deactivate “Breadcrumb NavXT 5.0 Migration Compatibility Layer” to make this message disappear.

To make this message disappear, navigate to the Plugins section of the WordPress admin. First, you will notice “Breadcrumb NavXT” in the list of plugins is not active, at this time you will want to activate it. Next, you will see a plugin named “Breadcrumb NavXT 5.0 Migration Compatibility Layer DO NOT ACTIVATE” deactivate this plugin.

Why is this Necessary?

In version 5.0, the file layout of Breadcrumb NavXT was reorganized. Due to this reorganization the plugin header information moved from breadcrumb_navxt_admin.php to breadcrumb-navxt.php. Additionally, breadcrumb_navxt_admin.php was removed from 5.0. Unfortunately, WordPress does not handle the change in plugin header location very nicely. Starting with 5.0.1, breadcrumb_navxt_admin.php was added back to the plugin, with a plugin header. However, this file now only exists to serve the notice to users about activating the plugin. Additionally, in Breadcrumb NavXT 5.2 this file will no longer be included with the release.

No, Really, Why is this Necessary?

Yes, the breadcrumb_navxt_admin.php file could automatically activate the new plugin file, and then deactivate itself. However, that sort of behavior is something plugins probably should not be doing, especially ones that are distributed from WordPress.org. So instead, the end user will have to intervene.

-John Havlik

[end of transmission, stay tuned]

Changes to Note Before Upgrading to Breadcrumb NavXT 5.0

Breadcrumb NavXT 5.0 is very close to being ready for release. Unlike a typical release, quite a bit has changed under the hood this time, hence the bump up from 4.4 to 5.0. Development for 5.0 focused heavily on making Breadcrumb NavXT easier to extend. In doing so, it had to part ways with how some things were done in the past. The following changes are the most likely to affect current Breadcrumb NavXT installs.

Move to PHP5 Object Model

This release features a move to PHP5′s Object Model, including changing the default constructor from the class name (C++ style) to __construct(). All member functions and variables are now explicitly scoped as either private, protected or public. Additionally, some member functions have been explicitly made static (to allow static calling without causing strict warnings in PHP5.4).

Organizational Changes

Several internal changes were made to reorganize the plugin. One change that will affect third party code is the move from bcn_breadcrumb_trail::trail to bcn_breadcrumb_trail::breadcrumbs. For 5.0, bcn_breadcrumb_trail::trail will exist as pointer to the same data held in bcn_breadcrumb_trail::breadcrumbs. In the future bcn_breadcrumb_trail::trail will be removed and it is recommended that existing extension plugins to Breadcrumb NavXT be updated to reflect this internal change.

WordPress Multisite Changes

Support for multisite WordPress installs has changed quite a bit in 5.0. To support the new Network Admin settings page introduced in this version, the way settings are handled in multisite installs has changed. By default the settings set in the ‘Network Admin’ settings page will take priority over individual site preferences. This is different from the pre-5.0 behavior. If you have a multisite install, please read Controlling Breadcrumb NavXT Settings From the Network Settings Page.

-John Havlik

[end of transmission, stay tuned]

Controlling Breadcrumb NavXT Settings From the Network Settings Page

Starting with Breadcrumb NavXT 5.0, the oft-requested feature for a Network Settings Page for controlling the setting on all subsites in a WordPress multisite setup is now available. Since now there will be a combination of Network Settings and sub site settings, some extra intelligence is needed to pick settings appropriately. Given that the desired behavior will vary depending on use case, a few new globals have been added to switch between settings behavior modes.

Force Network Settings on All Sites (default behavior)

Beginning with Breadcrumb NavXT 5.0 the default behavior for settings is changing. Now, rather than default to the individual site settings (as they were the only ones that existed in WordPress multisite setups prior to Breadcrumb NavXT 5.0). No additional defines need to be placed in your wp-config.php (or site specific plugin) to select this mode. Note that all other BCN_* defines must be either not set or set to false to select this mode. Note that in 5.0.1 and later you should manually specify this mode:

define('BCN_SETTINGS_USE_NETWORK', true);

Force Individual Site Settings Only (pre-5.0 behavior)

To enable the old, pre-5.0 behavior of using only the individual sub site settings for Breadcrumb NavXT in a WordPress Multisite setup, the following must be placed in your wp-config.php (or site specific plugin):

define('BCN_SETTINGS_USE_LOCAL', true);

Favor Individual Site Settings Over Network Settings

In Breadcrumb NavXT 5.0 this settings will merge the local (individual site’s) settings into the network settings (network settings are the ‘defaults’ for the wp_parse_args function). Use the following to enable this mode:

define('BCN_SETTINGS_FAVOR_LOCAL', true);

Note that the behavior of this mode is subtle and likely will look more like the local (individual site’s) settings than the network settings. In the future this mode may change slightly.

Favor Network Settings Over Individual Site Settings

In Breadcrumb NavXT 5.0 this settings will merge the network settings into the local (individual site’s) settings (local site settings are the ‘defaults’ for the wp_parse_args function). Use the following to enable this mode:

define('BCN_SETTINGS_FAVOR_NETWORK', true);

Note that the behavior of this mode is subtle and likely will look more like the network settings than the local (individual site’s) settings. In the future this mode may change slightly.

-John Havlik

[end of transmission, stay tuned]