2017 © Pedro Peláez
 

wordpress-plugin cmb2-nav-menus

image

nsrosenqvist/cmb2-nav-menus

  • Tuesday, June 19, 2018
  • by nsrosenqvist
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

CMB2 Nav Menus

Lets you use CMB2 in nav menu entries., (*1)

Register menu location to enable CMB2:, (*2)

// Add filter for locations
add_filter('cmb2_nav_menus', function($menu_slugs) {
    $menu_slugs[] = 'my_menu';

    return $menu_slugs;
}, 10, 1);

Register CMB2 fields for menu:, (*3)

// 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);

Get the nav menu item option with the included helper:, (*4)

cmb2_get_nav_option($menu_item_id, $key = '', $default = null);

The Versions

19/06 2018

dev-master

9999999-dev https://github.com/nsrosenqvist/cmb2-nav-menus

  Sources   Download

MIT

The Requires

  • php >=7.0.0
  • cmb2/cmb2 ^2.4.0

 

19/06 2018

1.0.1

1.0.1.0 https://github.com/nsrosenqvist/cmb2-nav-menus

  Sources   Download

MIT

The Requires

  • php >=7.0.0
  • cmb2/cmb2 ^2.4.0

 

18/06 2018

1.0.0

1.0.0.0 https://github.com/nsrosenqvist/cmb2-nav-menus

  Sources   Download

MIT

The Requires

  • php >=7.0.0
  • cmb2/cmb2 ^2.4.0