Magento – How I Can Add Link In Header For Social Media Icon

linksocial

I am trying to find the option that how I can edit the link of google plus in header.

I find in CMS > Static block but no success, Please help me, How can I edit or add the link

enter image description here

Best Answer

Here is how I did it.

I was using my custom theme. Go to folder app/design/frontend/vendor_name/theme_name/Magento_Theme/layout/default.xml

        <referenceContainer name="header-wrapper">
            <container name="custom.header" htmlClass="headerSitemenu" htmlTag="div">
                <block class="Magento\Framework\View\Element\Template" name="social.links" before="-" template="Magento_Theme::social-links.phtml">
                </block>
            </container>
        </referenceContainer>

My custom .phtml file name is social-links.phtml. In this file I have the following code. This file is located at <mage-root>/app/design/frontend/vendor_name/theme_name/Magento_Theme/templates/social-links.phtml

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */

// Social Icons Bar
// custom file added by Cameron Dixon

?>
<?php echo $this->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('header_social_test')->toHtml();?>

So my custom CMS Block name is

"header_social_test"

Related Topic