0

i am trying the following code :

<referenceContainer name="page.top"> <referenceBlock name="main_menu" remove="true" /> </referenceContainer>

in the DESIGN TAB> Layout Update XML in my page. but its not working.

my block's id is> 89 identifier is> main_menu and title is> Home 01- main menu. what else could i do to make this code work. basically, i want to remove this block from the homepage.

asked Feb 23, 2018 at 11:55

2 Answers 2

0

just hide it on home page.

check your body tag classes, there will be some unique class on home page body tag.

<body class="cms-home cms-index-index" >
</body>

by css you can hide it on only home page :)

answered Feb 23, 2018 at 12:14
8
  • can you tell me how and where to hide it? in which file? Commented Feb 23, 2018 at 12:15
  • can you give some html snippet from that block, which you want to hide? Commented Feb 23, 2018 at 12:17
  • <div class="main-menu menu-style-2">{{widget type="CleverSoft\CleverMegaMenus\Block\Widget\Megamenu" menu="main_menu"}}</div> <div class="zoo-customer-service text-right hidden-xs hidden-sm"> <p>Customer Service: <span style="font-weight: 600;"> (+xx) xxx- 7200-151</span></p> </div> thats the html used in this block Commented Feb 23, 2018 at 12:19
  • add in custom.css , body.cms-home div.main-menu.menu-style-2{display:none} Commented Feb 23, 2018 at 12:24
  • i am anxiously waiting for your humble suggestion and solutions Commented Feb 23, 2018 at 12:25
0

Have you try not to reference the Container?

As I see here, a friend has remove the wishlist sidebar only with Block's reference.

answered Feb 23, 2018 at 12:04
6
  • yes @christoforos i've tried it and doing this shows me the following error Commented Feb 23, 2018 at 12:06
  • Please correct the XML data and try again. Element 'referenceBlock': This element is not expected. Expected is one of ( referenceContainer, container, update, move ). Line: 1 Commented Feb 23, 2018 at 12:06
  • Have you enable path hints (Enabled Template Path Hints for Storefront) and block hints (Add Block Names to Hints) in the admin interface? You will find them here: Stores > Configuration > Advanced > Developer > Debug Commented Feb 23, 2018 at 12:09
  • maybe not. can you guid me how can i enable that setting? Commented Feb 23, 2018 at 12:09
  • I edit the comment. Check in the path I add. Commented Feb 23, 2018 at 12:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.