RNS CMB Text Datalist Field
Create text fields with datalists using Custom Metaboxes and Fields for WordPress
by David Herrera · github.com/religionnews/rns-cmb-text-datalist-field
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/religionnews/rns-cmb-text-datalist-field/archive/refs/heads/master.zipCreate text fields with datalists using Custom Metaboxes and Fields for WordPress
Description
This plugin creates a text_datalist field type for use with Custom Metaboxes and Fields for WordPress.
The text_datalist field works like the CMB text field but includes a <datalist> element. <datalist>s provide suggestions as the user completes the field, as illustrated here.
For <datalist> browser compatability, see caniuse.com.
Installation
- Upload the plugin to the
/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
The code for creating a text_datalist field looks identical to the code for creating a text field with the addition of the datalist key:
array(
'name' => 'My Text Datalist Field',
'desc' => 'field description (optional)',
'id' => $prefix . 'test_text_datalist',
'type' => 'text_datalist',
'datalist' => array( 'Apple', 'Banana', 'Cranberry' )
),
The value of datalist should be a numeric array, as illustrated above.
Screenshots
- An example of suggestions from a
<datalist>shown as the user types
Changelog
0.1
- Initial release