Home Forums ACF PRO ACF Field menu walker


ACF Field menu walker

  • Hello everybody,
    this is my first thread since I’m using ACF pro (about 4 years ;-).
    I created two customs fields for my menu, the first one is a color picker and the second one is select so as to the <ul> columns number.
    I created a new walker so as to have a div before my <ul> and change <ul> class.
    The walker works, Menu display as I want but, I don’t find how to display ACF fields.

    Here are my functions :

      function start_lvl( &$output, $depth = 0, $args = array() ) {
        $indent = str_repeat("\t", $depth);
        $output .= "\n$indent<div class=\"sub-menu\">\n";
        $output .= "\n$indent<ul class=\"column\">\n";
      function end_lvl( &$output, $depth = 0, $args = array() ) {
        $indent = str_repeat("\t", $depth);
        $output .= "$indent</ul>\n";
        $output .= "$indent</div>\n";

    My goal is to create a style=”background-color:ACF color field”; to sub-menu div and add ACF column class to column ul.

    Any help is really appreciated.



  • I reach to display color on the ancestor with the function start_el but not to the sub-menu div and add ACF column class to column ul…

      function start_el(&$output, $item, $depth=0, $args=array(), $id = 0) {
        $object = $item->object;
        $type = $item->type;
        $title = $item->title;
        $description = $item->description;
        $permalink = $item->url;
        $color = get_field('couleur_menu', $item->ID);
        $output .= "<li class='" .  implode(" ", $item->classes) ."' style=background-color:".$color.">";

    How can I do something close with function start_lvl ?

  • Hello,
    nobody can help me on this ?


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.