Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ramona

    (@nextend_ramona)

    Hi Steve ( @costellos )

    I would suggest putting your custom codes to this file:
    \wp-content\plugins\nextend-accordion-menu\types\wordpress\wordpress\menu.php

    At the bottom there is a filterItem() function, which you should insert the codes, depending on where would you like to display them. For example, if you put them like this (to the item->nname at the end):

    function filterItem($item) {
    
            $item->classes = implode(' ', $item->classes);
    
            $item->nname = '<span>' . $item->title . '</span>';
    
            if ($this->_config['displaynum'] && $item->productnum != 0) {
                $item->nname = $this->renderProductnum($item->productnum) . $item->nname;
            }
    
            if (!$this->_config['parentlink'] && $item->p) {
                $item->nname = '<a>' . $item->nname . '</a>';
            } else {
                $target = '';
                if(!empty($item->target)) $target =  'target="'.$item->target.'"';
                $item->nname = '<a '.$target.' data-gatype="" data-galabel="" href="' . $item->url . '">' . $item->nname . '</a>';
            }
        }

    Then the page source will look like this regarding to each item:
    <a data-gatype="" data-galabel="" href="#"><span>home</span></a></span>

    Thread Starter costellos

    (@costellos)

    Awesome, this was exactly what I needed. Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add Attributes to Menu?’ is closed to new replies.