Dan
Dan

Reputation: 717

Add new field in WordPress Menu to output in theme

Is there a simple class or function to extend the WordPress default menu items with new custom fields?

For example, when you go to Appearance - Menus, add a new menu and drag/drop an item to your menu, that actual item has few hidden fields that can be enabled from Screen Options:

My question is: how to add another custom field there? Like a background field to write the text there and output it in my custom theme like we output the title and description:

<?php echo $navItem->description; ?>

Changed the html code live on the admin page, so you can catch my idea on what I want to do.

enter image description here

Thanks!

Upvotes: 2

Views: 1495

Answers (2)

Hooman.AS
Hooman.AS

Reputation: 190

follow this URL may help you Adding custom Fields to WordPress Navigation Menu Items http://jafty.com/blog/how-to-add-custom-fields-to-wordpress-navigation-menu-items/

Upvotes: 0

Dipak Kumar Pusti
Dipak Kumar Pusti

Reputation: 1723

ACF is the plugin just what you looking for. Create as many fields as your want, assign it to manu form and you are done.

Menu Fields

For more information follow this URL,

https://www.advancedcustomfields.com/resources/adding-fields-menu-items/

Hope this helps.

Upvotes: 1

Related Questions