Breadcrumb NavXT 2010 Roadmap

With the first beta of WordPress 3.0 being available, it’s time to think about Breadcrumb NavXT once again. Currently, the SVN version of Breadcrumb NavXT works in WP 3.0. All versions of Breadcrumb NavXT prior to 3.5 (not released yet), have known bugs in WP 3.0.

As Breadcrumb NavXT 3.5 is already upping the minimum WordPress version to 2.8, support for custom post types won’t make this release. Some modifications to the core will be done to enhance extensibility for those who don’t want to use OOP techniques (e.g. filter/action hooks will be added). The first “beta” of this will be available, without updated translations, in the next two weeks. After a month of beta status, translations should be updated and a release in early May (will be moved up to be within a few days of the WordPress 3.0 release, if not before).

Breadcrumb NavXT 3.6 will require WordPress 2.9 as custom post type support will be added. Depending on the time available this release may have enhanced multi blog support. Currently, it looks like this will show up sometime in July.

Breadcrumb NavXT 3.7 will wrap up any multi blog support not covered in 3.6. Depending on how WordPress 3.0 and 3.1 turn out, this version may require WordPress 3.0. This will be a fall release, probably sometime in October.

-John Havlik

[end of transmission, stay tuned]

An Unexpect End Error

Ok, so a few of you have reported a PHP error involving an unexpected $end in breadcrumb_navxt_admin.php on line 1567. After some searching and thinking, the cause was found. Line 1248 of breadcrumb_navxt_admin.php has an improper opening tag (<? instead of <?php). For some reason only Windows based PHP installations were catching this. None-the-less, this has been fixed in the SVN trunk and a bug fix release, 3.4.1, will be made next week.

As one has not been able to reproduce this error on either of one’s testbeds, feedback from those who had this error is essential to ensuring that it is fixed. If you experience the error with Breadcrumb NavXT 3.4.0, please try the SVN trunk and see if it is resolved and report back in the comments section of this post.

-John Havlik

[end of transmission, stay tuned]

Vista-Like Breadcrumbs for WordPress

applevista-breadcrumbs2

Update: This was modified on February 10, 2015 to reflect changes in suggested calling code for Breadcrumb NavXT. Note that the Breadcrumb NavXT Multidimension Extensions plugin handles the PHP side of things covered in the guide below.

Update: This was modified on January 11, 2011 to reflect changes in the code base of Breadcrumb NavXT. Note that this should now work for all newer versions of Breadcrumb NavXT (3.6.0 up to 4.0). It will not work for the proposed Breadcrumb NavXT 4.0.

Previously, one revealed how to apply Janko’s Apple.com-like breadcrumb trail tutorial to WordPress using Breadcrumb NavXT. After several requests for a breadcrumb trail a la the one found in Explorer since Windows Vista, this guide was created. While this guide will not provide a method to exactly recreate the Vista breadcrumbs, it will be in the same spirit. The Apple.com breadcrumb trail style will be extended; a simple replacement of images and minor CSS tweaking will result something behaving very similar to the vista breadcrumb trail.

Download sources | View Demo

Continue reading

Breadcrumb Patent

Want a breadcrumb trail on your website that behaves like the Windows 7 Explorer breadcrumb trail? If you live within the United States, or any of its territories, then you may need a patent use license.

w7breadcrumb

US Patent Application No. 20080282199 covers all breadcrumb arrangements used on the internet that resemble those in Windows 7. This patent was filed in late 2008, and seems to be pending USPTO approval. While some of its claims cover features of Breadcrumb NavXT, Breadcrumb NavXT qualifies as prior art (Breadcrumb NavXT has supported hierarchical categories since 2.0.0 Beta 1, way back in November 2007).

This was found in the midst of research for implementing custom taxonomy support in Breadcrumb NavXT. In the next release, 3.4.0, taxonomy support will be completely reworked. This will enable support any flat and hierarchical taxonomy for post organization and archives. The former was implemented and in the SVN Trunk, the latter is a work in progress at the moment. Note that the SVN Trunk should be considered volatile at this time, and may contain code that does not fully work.

-John Havlik

[end of transmission, stay tuned]

Keep the Current Page Out of the Breadcrumb Trail

Note: This guide is only valid for versions of Breadcrumb NavXT prior to 4.0. Since Breadcrumb NavXT 4.0 the bcn_after_fill action should be used to remove breadcrumbs from the breadcrumb trail.

Over the past year, several individuals have inquired on the feasibility of removing the current item (page, post, etc) from the Breadcrumb trail. While this is not good form, every page in the hierarchy should be represented in the breadcrumb trail, one will discuss how to remove the current item from the breadcrumb trail.

As in the Keep a Page Out of the Breadcrumb Trail guide, the method discussed herein differs from earlier methods provided in response to comments elsewhere. Likewise, this method uses the OOP principle of inheritance and requires PHP5–as does Breadcrumb NavXT so that should not be a problem.

Previously, removing the current item from the breadcrumb trail was the suggested method of implementation. While this works great, it does have some flexibility issues. And, it will not work if the bcn_breadcrumb_trail::trail array is a private or protected member variable (which may happen in the future). Instead, this guide will override the bcn_breadcrumb_trail::display() member function.

First, open the functions.php file of your theme. Within it we are going to create a new class named ext_breadcrumb_trail, and tell PHP that it is an extension of the bcn_breadcrumb_trail class. We will place the skeleton for the class constructor in at this time as well.

class ext_breadcrumb_trail extends bcn_breadcrumb_trail
{
	//Default constructor
	function __construct()
	{
		//Need to make sure we call the constructor of bcn_breadcrumb_trail
		parent::__construct();
	}
}

Now, onto overriding bcn_breadcrumb_trail::display(). If you do not use bcn_breadcrumb_trail::display_trail() then this is all you will need:

class ext_breadcrumb_trail extends bcn_breadcrumb_trail
{
	//Default constructor
	function __construct()
	{
		//Need to make sure we call the constructor of bcn_breadcrumb_trail
		parent::__construct();
	}
	/**
	 * display
	 *
	 * Breadcrumb Creation Function
	 *
	 * This functions outputs or returns the breadcrumb trail in string form.
	 *
	 * @return void Void if Option to print out breadcrumb trail was chosen.
	 * @return string String-Data of breadcrumb trail.
	 * @param bool $return Whether to return data or to echo it.
	 * @param bool $linked[optional] Whether to allow hyperlinks in the trail or not.
	 * @param bool $reverse[optional] Whether to reverse the output or not.
	 */
	function display($return = false, $linked = true, $reverse = false)
	{
		//Set trail order based on reverse flag
		$this->order($reverse);
		//Initilize the string which will hold the assembled trail
		$trail_str = '';
		//The main compiling loop
		foreach($this->trail as $key=>$breadcrumb)
		{
			//Must branch if we are reversing the output or not
			if($reverse)
			{
				//Add in the separator only if we are the 2nd or greater element
				if($key > 0)
				{
					$trail_str .= $this->opt['separator'];
				}
			}
			else
			{
				//Only show the separator when necessary
				if($key > count($this->trail) - 2)
				{
					$trail_str .= $this->opt['separator'];
				}
			}
			//Trim titles, if needed
			if($this->opt['max_title_length'] > 0)
			{
				//Trim the breadcrumb's title
				$breadcrumb->title_trim($this->opt['max_title_length']);
			}
			//We want to output everything but the current item
			if($key === 0)
			{
				break;
			}
			//Place in the breadcrumb's assembled elements
			$trail_str .= $breadcrumb->assemble($linked);
		}
		//Should we return or echo the assembled trail?
		if($return)
		{
			return $trail_str;
		}
		else
		{
			//Giving credit where credit is due, please don't remove it
			$tag = "<!-- Breadcrumb NavXT " . $this->version . " -->\n";
			echo $tag . $trail_str;
		}
	}
}

The above code has only minor changes from the distributed bcn_breadcrumb_trail::display() code. One line was adjusted so that one less breadcrumb separator would be output. The other change involved replacing $this->current_item($breadcrumb); with break;, ending the loop execution. Note, if you want the “extra” breadcrumb separator to still display, change the line:

if($key < count($this->trail) - 2)

to:

if($key < count($this->trail) - 1)

If you need bcn_breadcrumb_trail::display_trail() instead of bcn_breadcrumb_trail::display() you will want to use the following code:

class ext_breadcrumb_trail extends bcn_breadcrumb_trail
{
	//Default constructor
	function __construct()
	{
		//Need to make sure we call the constructor of bcn_breadcrumb_trail
		parent::__construct();
	}
	/**
	 * display_list
	 *
	 * Breadcrumb Creation Function
	 *
	 * This functions outputs or returns the breadcrumb trail in list form.
	 *
	 * @return void Void if Option to print out breadcrumb trail was chosen.
	 * @return string String-Data of breadcrumb trail.
	 * @param bool $return Whether to return data or to echo it.
	 * @param bool $linked[optional] Whether to allow hyperlinks in the trail or not.
	 * @param bool $reverse[optional] Whether to reverse the output or not.
	 */
	function display_list($return = false, $linked = true, $reverse = false)
	{
		//Set trail order based on reverse flag
		$this->order($reverse);
		//Initilize the string which will hold the assembled trail
		$trail_str = '';
		//The main compiling loop
		foreach($this->trail as $key=>$breadcrumb)
		{
			$trail_str .= '
<li>';
			//Trim titles, if needed
			if($this->opt['max_title_length'] > 0)
			{
				//Trim the breadcrumb's title
				$breadcrumb->title_trim(
					$this->opt['max_title_length']);
			}
			//We want to output everything but the current item
			if($key === 0)
			{
				break;
			}
			//Place in the breadcrumb's assembled elements
			$trail_str .= $breadcrumb->assemble($linked);
			$trail_str .= "</li>

\n";
		}
		//Should we return or echo the assembled trail?
		if($return)
		{
			return $trail_str;
		}
		else
		{
			//Giving credit where credit is due, please don't remove it
			$tag = "<!-- Breadcrumb NavXT " . $this->version . " -->\n";
			echo $tag . $trail_str;
		}
	}
}

The only change in this code from the distributed bcn_breadcrumb_trail::display_trail() involved modifying the branch statement used for the current item. This involved replacing $this->current_item($breadcrumb); with break;. Now onto calling our new class. For users of the normal, sting output breadcrumb trail, you will use something on the lines of:

if(class_exists('ext_breadcrumb_trail'))
{
	//Make new instance of the ext_breadcrumb_trail object
	$breadcrumb_trail = new ext_breadcrumb_trail();
	//Setup options here if needed
	//Fill the breadcrumb trail
	$breadcrumb_trail->fill();
	//Display the trail
	$breadcrumb_trail->display();
}

While users of the HTML list output form of the breadcrumb trail will want to use:

if(class_exists('ext_breadcrumb_trail'))
{
	//Make new instance of the ext_breadcrumb_trail object
	$breadcrumb_trail = new ext_breadcrumb_trail();
	//Setup options here if needed
	//Fill the breadcrumb trail
	$breadcrumb_trail->fill();
	//Display the trail
	$breadcrumb_trail->display_list();
}

This is a quite simple method for removing the current item from the breadcrumb trail output. Since the display functions will not be modified in the foreseeable future, this is quite safe to use. Again, for usability reasons, one recommends you do not actually remove the current item from the breadcrumb trail.

-John Havlik

[end of transmission, stay tuned]