I've got this bit of code that works well for my Joomla setup
However, due to the way my main menu is set up, the first item in every page we have breadcrumbs enabled is always "Products" grayed out -( can't click) - this is due to "Products" being a "Menu Heading"
What can I do with the following so the first item is always the same link ( ie Product Category )
?>
<ul class="uk-breadcrumb"><?php
if (!$params->get('showLast', 1)) array_pop($list);
for ($i = 0; $i < $count; $i ++) {
if ($i == 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link) && $list[$i]->link == $list[$i - 1]->link)
{
continue;
}
// clean subtitle from breadcrumb
if ($pos = strpos($list[$i]->name, '||')) {
$name = trim(substr($list[$i]->name, 0, $pos));
} else {
$name = $list[$i]->name;
}
// mark-up last item as strong
if ($i < $count-1) {
if (!empty($list[$i]->link)) {
echo '<li><a href="'.$list[$i]->link.'">'.$name.'</a></li>';
} else {
echo '<li><span>'.$name.'</span></li>';
}
} else {
echo '<li class="uk-active"><span>'.$name.'</span></li>';
}
}
?></ul>
<?php endif; ?>
I tried adding the below to no avail
echo '<li><span><a href="https://www.example.com/products/product-category">Product Category</a></span></li>';
Essentially, I'm just trying change the Menu Heading in the breadcrumb to a hyperlink, I understand this may not be the best way (hard coding it in) but it will work for my situation.
$list
? "To no avail" -- you mean you write your static<li>
line before your loop and then what happens? Is it not printed? It is printed gray? Is this a css issue? Did you inspect the element to see what styles are being applied, then trace the style back to a css declaration that you might try to adjust?