PHPackages                             manzoorwanijk/cmb2-select-plus - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. manzoorwanijk/cmb2-select-plus

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

manzoorwanijk/cmb2-select-plus
==============================

Improved select field for CMB2

v1.0.1(2y ago)57732GPL-2.0-or-laterPHP

Since Feb 26Pushed 2y ago2 watchersCompare

[ Source](https://github.com/manzoorwanijk/cmb2-select-plus)[ Packagist](https://packagist.org/packages/manzoorwanijk/cmb2-select-plus)[ RSS](/packages/manzoorwanijk-cmb2-select-plus/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

CMB2 Field Type: select\_plus
=============================

[](#cmb2-field-type-select_plus)

Description
-----------

[](#description)

`select_plus` field type for [CMB2](https://github.com/CMB2/CMB2 "Custom Metaboxes and Fields for WordPress 2").

This plugin gives you an additional field type in CMB2: `select_plus`

The field acts much like the default `select` field. However, it adds the support for `optgroup` and saving of values with `multiple` attribute.

Installation
------------

[](#installation)

You can install this field type as you would a WordPress plugin:

1. Download the plugin
2. Place the plugin folder in your `/wp-content/plugins/` directory
3. Activate the plugin in the Plugin dashboard

Alternatively, you can include this field type within your plugin/theme.

You may also install this field type using composer:

```
composer require manzoorwanijk/cmb2-select-plus
```

Usage
-----

[](#usage)

#### Normal Select Field

[](#normal-select-field)

```
// Select Field without optgroup
$cmb->add_field( array(
	'name'		=> 'Normal Select',
	'id'		=> $prefix . 'normal_select',
	'type'		=> 'select_plus',
	'options'	=> array(
		'standard' => 'Option One',
		'custom'   => 'Option Two',
		'none'     => 'Option Three',
	),
) );
```

[![Image](screenshot-1.jpg?raw=true)](screenshot-1.jpg?raw=true)

#### Select Field with optgroup

[](#select-field-with-optgroup)

```
$cmb->add_field( array(
	'name'		=> 'Select+',
	'desc'		=> 'field description (optional)',
	'id'		=> $prefix . 'smart_select',
	'type'		=> 'select_plus',
	'options'	=> array(
		'Basic'	=> array( // optgroup
			1	=> 'Option One',
			2	=> 'Option Two',
			3	=> 'Option Three',
		),
		'Advanced'	=> array( // optgroup
			4	=> 'Option Four',
			5	=> 'Option Five',
			6	=> 'Option Six',
		),
	),
) );
```

[![Image](screenshot-2.jpg?raw=true)](screenshot-2.jpg?raw=true)

### `multiple` attribute

[](#multiple-attribute)

You can use the `multiple` attribute and the field value will be saved as array

```
// Select Field without optgroup and with multiple attribute
$cmb->add_field( array(
	'name'		=> 'Normal Select',
	'id'		=> $prefix . 'normal_select_multi',
	'type'		=> 'select_plus',
	'options'	=> array(
		'standard' => 'Option One',
		'custom'   => 'Option Two',
		'none'     => 'Option Three',
	),
	'attributes'	=> array(
		'multiple'	=> 'multiple',
	),
) );
```

```
// Select Field with optgroup and multiple attribute
$cmb->add_field( array(
	'name'		=> 'Select+',
	'desc'		=> 'field description (optional)',
	'id'		=> $prefix . 'smart_select_multi',
	'type'		=> 'select_plus',
	'options'	=> array(
		'Basic'	=> array( // optgroup
			1	=> 'Option One',
			2	=> 'Option Two',
			3	=> 'Option Three',
		),
		'Advanced'	=> array( // optgroup
			4	=> 'Option Four',
			5	=> 'Option Five',
			6	=> 'Option Six',
		),
	),
	'attributes'	=> array(
		'multiple'	=> 'multiple',
	),
) );
```

Why `Select_Plus_CMB2_Types` class?
-----------------------------------

[](#why-select_plus_cmb2_types-class)

- This enables you to use it flexibly in case you need to just render the field, not the whole row.
- It allows you to override the default args of the field

```
// field args
$args = array(
    'field_args'    => array(
        'id'        => 'some_id_here',
        'type'      => 'select_plus',
        'options'   => array(
            'standard' => 'Option One',
            'custom'   => 'Option Two',
            'none'     => 'Option Three',
        ),
) );
// create field
$field = new CMB2_Field( $args );

// pass the field to custom class
$types = new Select_Plus_CMB2_Types( $field );

// render the field with new id and name
echo $types->select_plus( array(
    'id'    => 'new_id_0_here',
    'name'  => 'smart[param][value]',
) );
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~172 days

Total

2

Last Release

1051d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd7d6ab63d39e3a6830d88d0a057709e38f540a74fa943a9464af03c854664a7?d=identicon)[manzoorwanijk](/maintainers/manzoorwanijk)

---

Top Contributors

[![manzoorwanijk](https://avatars.githubusercontent.com/u/18226415?v=4)](https://github.com/manzoorwanijk "manzoorwanijk (11 commits)")[![jonathanstegall](https://avatars.githubusercontent.com/u/435342?v=4)](https://github.com/jonathanstegall "jonathanstegall (1 commits)")[![macbookandrew](https://avatars.githubusercontent.com/u/784333?v=4)](https://github.com/macbookandrew "macbookandrew (1 commits)")

### Embed Badge

![Health badge](/badges/manzoorwanijk-cmb2-select-plus/health.svg)

```
[![Health](https://phpackages.com/badges/manzoorwanijk-cmb2-select-plus/health.svg)](https://phpackages.com/packages/manzoorwanijk-cmb2-select-plus)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[mediawiki/maps

Adds various mapping features to MediaWiki

84152.3k3](/packages/mediawiki-maps)[starcitizentools/citizen-skin

A beautiful, usable, responsive MediaWiki skin with in-depth extension support. Originally developed for the Star Citizen Wiki.

3376.6k](/packages/starcitizentools-citizen-skin)[civicrm/civicrm-drupal-8

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

19251.4k3](/packages/civicrm-civicrm-drupal-8)[altis/core

Core module for Altis

19228.0k3](/packages/altis-core)[pfefferle/wordpress-activitypub

The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.

5721.7k4](/packages/pfefferle-wordpress-activitypub)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
