I have 5 categories in main menu and want to add custom link in between menu.

How can I add this?

For example:

Menu1 Menu2 Menu3 Menu4 Custom_Link(Static) Menu5

Code Is:

        <?php /* @escapeNotVerified */ echo $_menu; ?>
<li class="vertical-submenu"><a href="<?php echo $block->getUrl('custom')?>"><?php echo __('Our story')?>

<div class="menu-dropdown">
<ul class="level0 submenu">
<li class="level1 nav-2-1 nav-1-1 first">
<a href="<?php echo $block->getUrl('custom1')?>">
<figure><img src="<?php echo $this->getUrl('pub/media/wysiwyg/') ?>custom1.jpg" /></figure>
<span><?php echo __('custom1') ?></span>
<li class="level1 nav-2-1 nav-1-2">
<a href="<?php echo $block->getUrl('custom2')?>">
<figure><img src="<?php echo $this->getUrl('pub/media/wysiwyg/') ?>custom2.jpg" /></figure>
<span><?php echo __('custom2') ?></span>

        <?php /* @escapeNotVerified */ //echo $block->getChildHtml(); ?>
  • You can do why jquery. Is it an option?
    – Gagan
    Aug 7 '18 at 5:33
  • 1
    I meant via jquery!
    – Gagan
    Aug 7 '18 at 5:47
  • You can add this link if category Menu4 fixed always. Aug 7 '18 at 6:14
  • @LAW I have done using jquery. Aug 7 '18 at 8:54
  • @VinodKumar Cool, It would be great if you share your answer here, so that others can get help!
    – Gagan
    Aug 7 '18 at 9:07

Using jQuery you can do easily.

jQuery('a[href*="//www.host.com/host-collection"]').attr({onClick:"return redirectFunction1()",href:"javascript:void(0);"});

function redirectFunction1() {

 window.open("//www.host.com/[your custom link]", "_blank");


You need to create extra menu link between menu 4 and menu 5 and replace that menu link in above script.

  • I don't want to create category, I have added plugin to create custom link which is add in last but i want to add in between or before last menu. Aug 7 '18 at 5:43
  • You need to create menu link as you already created in admin panel. Aug 7 '18 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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