0

Sorry if it's in the wrong category and I'm just asking for help. I'm not a developer but I've changed dabbled in Magento 1 coding mainly just removing stuff or moving it.

I'm confused how it works in Magento 2. Right clicking in Developer tools on Chrome, shows the links are sitting in header links. For the life of me, I can't find this.

I have even tried looking under default.xml under the theme I have bought and this is the only code in the file.

<referenceContainer name="header-wrapper-container">
<container name="header.wrapper.container.top" htmlTag="div" htmlClass="header-wrapper-container-top" before="-">
<container name="header.area.1" htmlTag="div" label="Header Area 01" htmlClass="header-area-01 hidden-xs" before="-" />     

</container>

<container name="header.wrapper.container.bottom" htmlTag="div" htmlClass="header-wrapper-container-bottom" after="header.wrapper.container.top">
<block class="Magento\Theme\Block\Html\Header\Logo" name="smalllogo" template="html/header/smalllogo.phtml" before="-" />  

</container>
</referenceContainer>

<move element="logo" destination="header.wrapper.container.top" after="header.area.1" />
<move element="navigation.sections" destination="header.wrapper.container.bottom" after="smalllogo" />


<referenceBlock name="footer_links" display="true" />                   

<move element="footer_links" destination="footer" after="copyright" />
</body>
</page>

I have two Links I want to remove (Wishlist and Compare as seen here - www.peakaboo.co.uk. I also want to move the Cart into the navigation like http://newsmartwave.net/magento/vigoshop/index.php/?___store=demo2_default.

I've checked through most folders and found other other phtml files but nothing about header links, or top.links. (I've also tried that top.links).

I hope someone can help me.

Regards,

2 Answers 2

1

Please follow the below instructions :

Step 1 :- Go to app/design/frontend/VenderName/ThemeName/Magento_Theme/layout/default.xml

Step 2 :- Copy below Code

<referenceBlock name="wish-list-link" remove="true"/>
<referenceBlock name="catalog.compare.link" remove="true"/>

Step 3 :- Paste this code in default.xml before body tag () and save it.

It will remove the links from the header

0

the "base theme" now is defined inside the modules itself.

In Magento2, the layout files in the template only extend / manipulate the layout from the original module (while in magento1 the layout file overwrites the layout of the base theme) which is why the layout files in magento2 themes are pretty small compared to magento1 themes.

What you are searching for is the original layout file from the Magento_Theme module: https://github.com/magento/magento2/blob/develop/app/code/Magento/Theme/view/frontend/layout/default.xml#L43

The Wishlist link for example is defined in the Wishlist Modules Layout file: https://github.com/magento/magento2/blob/develop/app/code/Magento/Wishlist/view/frontend/layout/default.xml#L14

You can remove it in your custom theme by adding the following line to the body section:

<referenceBlock name="wish-list-link" remove="true"/>
3
  • Hi David, Makes sense. But where would that line you provided go? There is also a Compare bit that I want to remove. I guess it's the same thing. So the theme I bought is just using the Base theme to display certain things? How would I add the cart to the top? Thanks
    – Desibouy
    May 22, 2016 at 22:18
  • you could for example place it in the theme under Magento_Theme/layout/default.xml in the body section. Or in Magento_Wishlist/layout/default.xml, which would make more sense. For further questions please open new Questions instead of asking them in the comments May 22, 2016 at 22:23
  • Thanks, I appreciate it and sure. I'll try this and come back.
    – Desibouy
    May 22, 2016 at 22:33

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.