In Magento 2, I want to add custom cms page link in header menu before wishlist link.

Please tell me how we can add custom page link before wishlist link?

  • Which is theme are you use in ? Aug 23, 2016 at 9:13

3 Answers 3


You have to add bellow code to in your theme default.xml

<referenceBlock name="top.links">
    <block class="Magento\Framework\View\Element\Html\Link\Current" name="cms-page-name"  before="wish-list-link">
            <argument name="label" xsi:type="string">cms-page-name</argument>
            <argument name="path" xsi:type="string">cms-page-path</argument>

Clean cache and check.

Let me know if you have any difficulty.


you have to just override template file for wishlist into your theme.



Now you can write down your cms page link code before wishlist code, this tag.

<?php $link = 'Cms page link'; ?>
    <div class="link cmspage">
        <a <?php echo $link; ?>>CMS Page</a>

In Namespace/ModuleName/view/frontend/layout/default.xml

<?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">
    <referenceContainer name="header.container">
        <block class="Magento\Framework\View\Element\Html\Links" name="top.links">
                        <argument name="css_class" xsi:type="string">header links</argument>
                    <block class="Namespace\ModuleName\Block\Links\Link" name="linkname" before='wish-list-link'/>



namespace Namespace\ModuleName\Block\Links;
class Link extends \Magento\Framework\View\Element\Html\Link
public function __construct(
    \Magento\Framework\View\Element\Template\Context $context,
    array $data = []
) {
    parent::__construct($context, $data);

public function getHref(){

    $page_url = '[cms url key]'; 
    return $this->getUrl($page_url);

public function getLabel(){
     return '[Link Name]';

Not the answer you're looking for? Browse other questions tagged or ask your own question.