2

I have the standard breadcrumbs on my page, but I want to add a second copy.

I've tried to add another block the same as defined in module-theme default xml:

<block class="Magento\Theme\Block\Html\Breadcrumbs" name="crumbs"/>

This does not display.

Should there be a template reference? e.g.

template="Magento_Theme::html/breadcrumbs.phtml"

How do I add this to my layout?

1 Answer 1

4

We can render breadcrumbs in templates(phtml) like below

<?= $block->getLayout()->getBlock('breadcrumbs')->toHtml(); ?>

just add the above line in which phtml file you want to show breadcrumbs.

It worked for me in category page and product detail page. I tested these two pages only :-)

2
  • how I can add this to block at admin side ?
    – Learner
    Commented Nov 29, 2017 at 15:24
  • i am getting this error on category page can you reply me Call to a member function toHtml() on boolean Commented Jul 19, 2018 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.