I am using Advanced Custom Fields on my pages to create a field called page_color
. The field is a select that allows for 4 different values. In my menu, I would like pages to appear automatically and have a class is-orange
or is-green
(or whatever color) in the list item, based on the value the user has selected on the corresponding page. I am not certain the best way to approach (e.g., walker function, extending the wp_nav_menu_items
function) and would appreciate some help/direction.
Thanks!
In case someone stumbles across this, I will post the answer I found.
The route I used was creating my own Walker class and using
$item->object_id
to get the id of the corresponding page to then retrieve the value I need with ACFget_field('field_name', id)
function.