For Wordpress, when creating a page, a menu entry will be added to top level menu automatically. I have disabled this feature because it is not what I what.
开发者_JAVA百科What I want is, like Drupal, when creating a page, I can have a dropdown select to select which menu to add this page to and to which parent.
Which plugin can do that?
Thank you.
You can do it yourself. What you need to do is:
- Use
add_meta_box
to add a meta box to your post editor. In that meta box, build a list of available menus using results fromget_registered_nav_menus()
function. - Add a hook to
save_post
action, which will create a menu item. - Create a menu item by calling
wp_save_nav_menu_items($menu_id, $item_data)
It is not a piece of cake, but you can do it in a couple of hours.
精彩评论