0

Ive created already custom Walker Nav Menu in WordPress, but now I need to create an custom element on submenu like that with custom edit of this fields text and buttons https://i.stack.imgur.com/w6WQH.png

Trying this code, but it didnt show me my custom element:

add_filter( 'wp_nav_menu_items', 'your_custom_menu_item', 10, 2 );
function your_custom_menu_item ( $items, $args ) {
    if (is_single() && $args->theme_location == 'primary') {
        $items .= '<li><p>Show whatever</p><li>';
    }
    return $items;
}
hakre
  • 193,403
  • 52
  • 435
  • 836
Georgy
  • 1
  • 2
  • Can you share why you think it should show up now as you have found it it didn't? Not a trick question, what is your understanding why it should have worked in the first place? – hakre Aug 05 '23 at 16:13

0 Answers0