admin管理员组

文章数量:1397049

When editing Menus, I find 5 typs of items that can be added:

  • Custom Links
  • Pages
  • Posts
  • Categories
  • Tags

Would it be possible to add custom ones? Let's say for instance that I want to add an image, or a search bar, or whatever.

Could I somehow add new menu items types, that render the code that I choose for them?

When editing Menus, I find 5 typs of items that can be added:

  • Custom Links
  • Pages
  • Posts
  • Categories
  • Tags

Would it be possible to add custom ones? Let's say for instance that I want to add an image, or a search bar, or whatever.

Could I somehow add new menu items types, that render the code that I choose for them?

Share Improve this question asked Feb 7, 2020 at 10:48 Enrique Moreno TentEnrique Moreno Tent 2771 gold badge3 silver badges11 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

Not in the menu management interface.

You can inject custom elements if you create a custom nav walker. This requires some coding skill as well as trial and error to figure out which parts of the code you need to use, and how to tweak them.

Or, if you're comfortable using JavaScript to change things after the menu is built (so some visitors and search engines might not see the change), you could use a document.ready script that identifies a "regular" menu item and then injects whatever image etc. you want to display in its place.

You will need a plugin for that. For example, something like this one: https://wordpress/plugins/wp-megamenu/

本文标签: Custom items for Menus