admin管理员组

文章数量:1290090

I have a menu, and having hard time to find the menu item and then change the content of it. I only want this single menu after that I continue the rest of the code.

This menu item is page, and I want to plan it if I hover on it, it shows my recent latest post on it. but for now I want to get the hook on how to find this like this in PHP example $menu[6] = $myCustomHTMLCode, but on Wordpress, I am having hard time.

for now this is my code. but this is wrong, it added on that last area, and also its not the content when hover is added. Sorry for being not good on wordpress. having hard time learning on the documentation.

add_filter( 'wp_nav_menu_items', 'edit_item_to_nav_menu', 10, 2 );
function edit_item_to_nav_menu( $items, $args ) {
    $items .= '<li><a href="#">test</a></li>';
    return $items;
}

EDIT 1

I want to duplicate this function on this image, but I don't know how to get the ID of the menu then add the content code on it. I am stuck on the ID cause I having hard time understand the hook in WOrdpress, but in like in normal array in PHP it's only like this $menu[7][$sub_menu] = myCustomHTMLCode

本文标签: plugin developmentHow to change the hover content of a specific menu item on Wordpress