This plugin adds custom fields on menu item's edit interface of wp-admin.
This plugin adds custom fields on the menu item’s edit interface of wp-admin and supports only 1-level menu configuration.
Below is the list of custom fields this plugin adds.
Notes:
[video]
and [audio]
shortcode.$html
(Generated HTML), $data
(Custom fields data), $item_id
(Menu item ID).Example:
[selected-feature] => image [image] => Array ( [media-id] => 11 [media-type] => image [media-link] => https://google.com/ [media-caption] => This is image caption [media-url] => http://example.com/wp-content/uploads/2020/03/92d43b978cbcdc7b33e3596d131d5256.jpg )
wp_menu_custom_fields_image_html
.Example:
[selected-feature] => shortcode [shortcode] => Array ( [shortcode] => [video src="https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4"] [shortcode-caption] => This is a shortcode caption )
wp_menu_custom_fields_image_html
.Example:
[selected-feature] => html [html] => Array ( [custom-html] => <em><strong>This is custom HTML</strong></em> )
wp_menu_custom_fields_image_html
.Example:
[custom-text] => This is a custom text
wp_menu_custom_fields_image_html
.Example:
Array ( [custom-text] => This is a custom text [selected-feature] => image [image] => Array ( [media-id] => 11 [media-type] => image [media-link] => https://google.com [media-caption] => This is image caption [media-url] => http://example.com/wp-content/uploads/2020/03/92d43b978cbcdc7b33e3596d131d5256.jpg ) )
A theme developer can add stylings for the custom fields added by this plugin by referring to the below sample HTML code.
Image & Custom text
Sample HTML code
<div class="rt-wp-menu-custom-fields-wrapper" style="padding-top: 10px; padding-right: 20px;"> <div class="rt-wp-menu-custom-fields-image-wrapper"> <a href="https://google.com"> <img class="rt-wp-menu-custom-fields-image" src="http://example.com/wp-content/uploads/2020/03/92d43b978cbcdc7b33e3596d131d5256.jpg"> </a> <span class="rt-wp-menu-custom-fields-image-caption">This is an image caption</span> </div> <span class="rt-wp-menu-custom-fields-custom-text">This is a custom text</span> </div>
If Image Link is entered, then img
tag will be wrapped inside a
.
Shortcode
<div class="rt-wp-menu-custom-fields-shortcode-wrapper"> <div class="rt-wp-menu-custom-fields-shortcode"> <!-- shortcode HTML will be here --> </div> <span class="rt-wp-menu-custom-fields-shortcode-caption">This is shortcode caption!</span> </div>
Custom HTML
<div class="rt-wp-menu-custom-fields-custom-html">Welcome to <strong>WordPress</strong>. This is your first post. Edit or delete it, then start <em>writing</em>!</div>
Same GPL that WordPress uses!
Great! There are several ways you can get involved to help make this plugin better:
/wp-content/plugins/
directory in your WordPress installation.Custom text field added under Appearance -> Menus
Custom text field (frontend)
Custom image field added under Appearance -> Menus from WP-Media
Custom image field (frontend from WP-Media)
Custom image field added under Appearance -> Menus from image url
Custom image field (frontend from image url)
Custom shortcode field added under Appearance -> Menus
Custom shortcode field (frontend)
Custom HTML field added under Appearance -> Menus
Custom HTML field (frontend)
FIXED
* Fix UI bugs with default themes
* Fix fatal error related to unknown format specifier with PHP v8.x.x
* Fix image not showing when added with a link
FIXED
* Fix audio Shortcode not rendering on frontend
* Fix few notices
FIXED
* Class WP_Menu_Custom_Fields\Inc\Plugin
not found error on Windows platform