DataSource/WpciQuery.php
public function addMenu()
    {
        $menuLocations = $this->wpProvider
            ->getNavMenuLocations();

        $data = [];

        foreach ($menuLocations as $menuLocation => $menuId) {
            $menu = $this->wpProvider
                ->wpGetNavMenuItems($menuId);

            foreach ($menu as $menuItem) {
                $item = new stdClass();

                /**
                 * @var WpPost $menuItem
                 */
                $item->item = $menuItem->title;
                $item->link = $menuItem->url;
                $item->active = (Path::getCurrentUrl() === $menuItem->url) ? true : false;

                $data[$menuLocation][] = $item;
            }
        }

        $this->mergeToTheData($data);
        return $this;
    }
public function addMenu()
    {
        $menuLocations = $this->wpProvider
            ->getNavMenuLocations();

        $data = [];

        foreach ($menuLocations as $menuLocation => $menuId) {
            $menu = $this->wpProvider
                ->wpGetNavMenuItems($menuId);

            foreach ($menu as $menuItem) {
                $item = new stdClass();

                /**
                 * @var WpPost $menuItem
                 */
                $item->item = $menuItem->title;
                $item->link = $menuItem->url;
                $item->active = (Path::getCurrentUrl() === $menuItem->url) ? true : false;

                $data[$menuLocation][] = $item;
            }
        }

        $this->mergeToTheData($data);
        return $this;
    }
public function addMenu ( ) { $ menuLocations = $ this -> wpProvider -> getNavMenuLocations ( ) ; $ data = [ ] ; foreach ( $ menuLocations as $ menuLocation => $ menuId ) { $ menu = $ this -> wpProvider -> wpGetNavMenuItems ( $ menuId ) ; foreach ( $ menu as $ menuItem ) { $ item = new stdClass ( ) ; /**
                 * @var WpPost $menuItem
                 */ $ item -> item = $ menuItem -> title ; $ item -> link = $ menuItem -> url ; $ item -> active = ( Path :: getCurrentUrl ( ) === $ menuItem -> url ) ? true : false ; $ data [ $ menuLocation ] [ ] = $ item ; } } $ this -> mergeToTheData ( $ data ) ; return $ this ; }
Add menus to template
@return $this
@throws \ErrorException
Add menus to template