- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017
01:35 AM
03-14-2017
01:35 AM
Adding a new block after the main navigation
Hello!
How can i add a custom block right after the main navigation? I am extending the Luma theme.
I created the block and i can add it to static page, but not to a layout file.
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017
03:01 AM
03-14-2017
03:01 AM
Re: Adding a new block after the main navigation
catalog.topnav is the block you need. You must put the block that you want to display in your default.xml.
<block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600" before="-"/>
Try the following and let me know if that helps:
<referenceContainer name="page.top"> <block class="Magento\Cms\Block\Block" name="my.custom.block" after="catalog.topnav"> <arguments> <argument name="block_id" xsi:type="string">Customer-block-id</argument> </arguments> </block> </referenceContainer>
Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post
If this response was helpful to you, consider giving kudos to this post
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017
03:10 AM
03-14-2017
03:10 AM
Re: Adding a new block after the main navigation
Thank you, but this removes the topnav completly. This is my layout
<?xml version="1.0"?> <!-- /** * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="header.panel"> <block class="Magento\Framework\View\Element\Html\Links" name="header.links"> <arguments> <argument name="css_class" xsi:type="string">header links</argument> </arguments> </block> </referenceContainer> <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600" before="-"/> <referenceContainer name="page.top"> <block class="Acty\Slider\Block\Slider" name="my.custom.block" after="catalog.topnav"> <arguments> <argument name="block_id" xsi:type="string">Customer-block-id</argument> </arguments> </block> </referenceContainer> </body> </page>
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017
03:12 AM
03-14-2017
03:12 AM
Re: Adding a new block after the main navigation
Just remove <referenceContainer name="page.top"> section and try again. Also, try redeploying the static content as well.
Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post
If this response was helpful to you, consider giving kudos to this post
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017
03:16 AM
03-14-2017
03:16 AM
Re: Adding a new block after the main navigation
Sorry, this is not working