Thread Starter
m7csat
(@m7csat)
Here’s my complete hack job of a solution that basically switches the last two elements:
add_action('bcn_after_fill', 'my_static_breadcrumb_adder');
function my_static_breadcrumb_adder($trail)
{
if ( is_single() ) {
$trail->add(new bcn_breadcrumb('Blog', NULL, array('blog'), '/blog'));
$bccount = count($trail->breadcrumbs);
$tempspot = $trail->breadcrumbs[$bccount - 2];
$trail->breadcrumbs[$bccount - 2] = $trail->breadcrumbs[$bccount - 1];
$trail->breadcrumbs[$bccount - 1] = $tempspot;
}
}
If anyone has a better idea, I’m open to it.
Just a few notes on this. Rather than calling bcn_breadcrumb_trail::add(), normally I would manually instantiate a new bcn_breadcrumb object. Then inject it into the correct spot into bcn_breadcrumb_trail::breadcrumbs using the PHP array_splice() function. That saves you from having to juggle around entities in the bcn_breadcrumb_trail::breadcrumbs array.
Thread Starter
m7csat
(@m7csat)
Thanks, John. Would you mind posting sample code? I tried array_splice based on something I found on Stack Overflow and it kept throwing errors.