0

I am working on a Magento 2.1.7 shop. To achieve this, I have created a child-theme of Magento Blank.

By default, it seems, Magento displays links to the product categories (and subcategories) in the top bar. I need to display only the CMS (static) pages there.

The code from default.xml that displays the top bar is:

<container name="navbar-collapse" htmlTag="div" htmlClass="collapse navbar-collapse" htmlId="wg-navbar-collapse">
  <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600" before="-">
     <arguments>
       <argument name="parent_item_class" xsi:type="string">dropdown</argument>
       <argument name="submenu_class" xsi:type="string">dropdown-menu</argument>
     </arguments>
  </block>
</container>

Replacing catalog.topnav with cms.topnav did not produce any change in the frontend. I could not find a way to do that through the admin either.

How must I do it?

Alternatively, is there a free plugin for this functionality?

Thank you!

3
  • This will require you to create a custom module or buy an extension, since this functionality is not part of Magento core
    – gabehou
    Oct 25, 2017 at 16:00
  • Where can I copy one from? Magento is really new to me. Oct 25, 2017 at 16:10
  • You will need to develop one from scratch or buy an extension, It's a long process creating this functionality
    – gabehou
    Oct 25, 2017 at 16:13

1 Answer 1

0

You have to create a plugin in your custom module to achieve this. Have a look at this answer to add your cms-page/custom-link in top menu.

Adding a non-category link to the navigation links in magento 2

2
  • Is there a free plugin for this functionality? Oct 26, 2017 at 8:55
  • It's a custom plugin. You can create your own plugin using above link. If you are creating your own custom plugin then it is absolutely free :) Oct 26, 2017 at 9:09

Your Answer

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

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