1. Go to this page and download the library: Download nsrosenqvist/cmb2-nav-menus library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// For all menus
add_filters('cmb2_nav_menu_fields, function($fields) {
// You can set ID both as the key and in the array
$fields['icon-class'] = [
'name' => __( 'Icon Class', 'theme' ),
'type' => 'fontawesome_icon',
'help' => 'Choose a FontAwesome icon class name (eg. fa-circle)',
];
}, 10, 1);
// For specific menu
add_filters('cmb2_nav_menu_fields_my_menu, function($fields) {
// You can set ID both as the key and in the array
$fields['disabled'] = [
'name' => __( 'Disabled', 'theme' ),
'type' => 'checkbox',
'style' => 'thin',
];
}, 10, 1);