Nav items with Icons
fabianwurk opened this issue · 4 comments
fabianwurk commented
Brandon, is there a way to add different icons beside nav items using Navi (ps. currently using Tailwind so trying to avoid using css pseudo classes). Thanks
Log1x commented
If you're using ACF, the easy way would be the just add a menu icon field to the navigation items.
$menu = new FieldsBuilder('menu');
$menu->setLocation('nav_menu_item', '==', 'location/primary_navigation');
$menu->addText('menu_icon');
and then in your Navigation blade view loop, you can just get_field
the menu item ID:
get_field('menu_icon', $item->id)
fabianwurk commented
Thanks Brandon, but where would I add this block of code in Sage10?
$menu = new FieldsBuilder('menu');
$menu->setLocation('nav_menu_item', '==', 'location/primary_navigation');
$menu->addText('menu_icon');
From: Brandon <notifications@github.com>
Date: Wednesday, 20 January 2021 at 19:38
To: Log1x/navi <navi@noreply.github.com>
Cc: Fabian McElhill <fabian@wurkhouse.com>, Author <author@noreply.github.com>
Subject: Re: [Log1x/navi] Nav items with Icons (#30)
If you're using ACF, the easy way would be the just add a menu icon field to the navigation items.
$menu = new FieldsBuilder('menu');
$menu->setLocation('nav_menu_item', '==', 'location/primary_navigation');
$menu->addText('menu_icon');
and then in your Navigation blade view loop, you can just get_field the menu item ID:
get_field('menu_icon', $item->id)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#30 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEL7IWNMHB6DDIH7CGXG5MTS24WLNANCNFSM4WK7SVZA>.
Log1x commented
That was just a dummy example using https://github.com/Log1x/acf-composer
You can add the field however you add field groups (assuming you're using ACF)
fabianwurk commented
Ah perfect, I get you. Thanks so much 👍
From: Brandon <notifications@github.com>
Date: Wednesday, 20 January 2021 at 20:36
To: Log1x/navi <navi@noreply.github.com>
Cc: Fabian McElhill <fabian@wurkhouse.com>, Author <author@noreply.github.com>
Subject: Re: [Log1x/navi] Nav items with Icons (#30)
That was just a dummy example using https://github.com/Log1x/acf-composer
You can add the field however you add field groups (assuming you're using ACF)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#30 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEL7IWLN255BZMRG5NZA633S245DNANCNFSM4WK7SVZA>.