1

I have created custom link under

app\design\frontend\Myrwd\mytheme\Magento_Theme\layout\default.xml

<!-- location added in header -->
<referenceBlock name="header.links">
<block class="Magento\Framework\view\Element\Html\Link" name="custom-link" before="-">
<arguments>
<argument name="label" xsi:type="string" translate="true"> Custom Link </argument>
<argument name="path" xsi:type="string" translate="true"> customlink </argument>
</arguments>
</block>
</referenceBlock>

Now my custom link placed between customer link and minicart, how should place right after logo?

Workout :

In same path (app\design\frontend\Myrwd\mytheme\Magento_Theme\layout\default.xml)

I have added,

<move element="custom-link" destination="header-panel" after="logo" /> 

Its not working, how to solve the issue?

7
  • The header should be responsive by default if you had inherited the theme and header properly. Please post the code of your layout xml so we can check anything that you did wrong. Dec 14, 2020 at 6:55
  • May i know which file you exactly need?
    – zus
    Dec 14, 2020 at 7:00
  • Can you pls join chat?
    – zus
    Dec 14, 2020 at 7:03
  • chat.stackexchange.com/rooms/117247/…
    – zus
    Dec 14, 2020 at 7:03
  • is bootstrap working properly?
    – fmsthird
    Dec 14, 2020 at 7:09

4 Answers 4

2
+100

Replace this below code inside your default.xml file :

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="header.links">
            <block class="Magento\Framework\view\Element\Html\Link" name="custom-link" before="-">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true"> Custom Link </argument>
                    <argument name="path" xsi:type="string" translate="true"> customlink </argument>
                </arguments>
            </block>
        </referenceBlock>
        <move element="custom-link" destination="header-wrapper" after="logo" />
    </body>
</page>

Clean cache and check it.

11
  • My logo under "panel header" and the custom link placed under "header content". FYI for UI customization i moved all the header content into panel header which means move all things to top header?
    – zus
    Dec 14, 2020 at 10:53
  • Then, just change destination and check it. Dec 14, 2020 at 11:15
  • If I change with destination="panel-header" custom link hide.
    – zus
    Dec 14, 2020 at 11:34
  • You want to move custom link inside panel header. Right? Dec 14, 2020 at 11:44
  • 1
    New post : magento.stackexchange.com/q/328034/57334
    – zus
    Dec 17, 2020 at 6:06
1

Try it :-

You can create custom container in header :-

<referenceContainer name="header-wrapper">
     <container name="your-container-name" label="Header Top" htmlTag="div" htmlClass="your-header-top" after="logo">
     </container>
</referenceContainer>

After Create container you can move your custom link in custom container :-

<move element="custom-link" destination="your-container-name" before="-" />
1
  • try this and let me know if not working.
    – Himanshu
    Dec 15, 2020 at 6:25
0

Try this,

<move element="custom-link" destination="header-wrapper" after="logo" /> 
3
  • My logo under "panel header" and the custom link placed under "header content". FYI for UI customization i moved all the header content into panel header which means move all things to top header?
    – zus
    Dec 14, 2020 at 10:53
  • please share your full code of the file Dec 14, 2020 at 11:46
  • full code : chat.stackexchange.com/rooms/117253/…
    – zus
    Dec 14, 2020 at 12:02
0

you have a typo mistake in your move tag

<move element="custom-link" destination="header-panel" after="logo" /> 

the destination should be header.panel

<move element="custom-link" destination="header.panel" after="logo" />

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.