Showing results for 
Search instead for 
Did you mean: 

Add Custom CMS to Header link

Add Custom CMS to Header link

I am trying to add a button called "social media" to be beside the Storeview switcher.
I tried to follow the answer in:

So I created a CMS block on the backend called 'social media' with id 'social_media'.

I also add the following to the:




<referenceBlock name="header.links">
<block class="Magento\Cms\Block\Block" name="" before="-">
<argument name="block_id" xsi:type="string">social_media</argument>

However, it didn't work.

So my question: what is the right way to add such a button to the header links in magento 2.3.5 ?


Re: Add Custom CMS to Header link

Hello @achahinewiffa8 


It should have worked, Run below commands from your docroot :

php bin/magento setup:static-content:deploy -f
php bin/magento c:f

also add some random text keyword in case anchor is not working.

Let us know if it still doesn't work.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Add Custom CMS to Header link

In fact, the above code didn't work in my case.

whenever I add the code, a new button called "contact us" shows in the right side of the header.

Knowing that the header already has a contact us button, so in fact I am having 2 contact us button by adding the above code.

While the social media is not showing at all.