Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter alexqpe

    (@alexqpe)

    Thank You ! Your solution works perfectly !

    Here is my code :

    add_filter('megamenu_nav_menu_css_class', 'add_color_classes', 1, 3);
    function add_color_classes($classes, $item, $args)
        {
            // Main nav only
            if ($args->theme_location == 'main-navigation') {
                // First level only
                if (intval($item->menu_item_parent) === 0) {
                    $page_id = intval($item->object_id);
                    $page_color = get_field('page_accent_color', $page_id)['label'];
                    $classes[] = sanitize_html_class($page_color);
                }
            }
            return $classes;
    }
    • This reply was modified 3 years, 10 months ago by alexqpe.
Viewing 1 replies (of 1 total)