CMB2 Drag and Drop field type which allows drag and drop between two different containers and display output of predefined options. You could add as many options as you like, after drag and drop item will be cloned back and process starts again,
- Contributors: Freelancer Martin
- Homepage: http://developerforwebsites.com
- Tags: CMB2 Field Type: Drag and Drop(Clone)
- Requires at least: 3.8.0
- Tested up to: 4.9.1
- Stable tag: 1.0.0
- License: GPLv2 or later
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
Development occurs on Github, and all contributions welcome.
If including the library in your plugin or theme:
- Upload or Intall the entire /cmb2-drag-and-drop directory to the /wp-content/plugins/ directory.
- Upload the entire plugin directory to the /wp-content/plugins/ directory.
- Activate WDS CMB2 Customizer through the 'Plugins' menu in WordPress.
- Copy (and rename if desired) example-functions.php into to your theme or plugin's directory.
- Every option added are displayed as item and popup ids, add has many you like (Examples Below:
'options' => array( 'image-0' => 'Image 0', 'image-1' => 'Image 1', 'image-3' => 'Image 3', 'image-4' => 'Image 4', ), </pre>)
CMB2 Drag and Drop field type allows you to add many drag and drop elements ass you like. Just add extra options under cmb2 tab and all elements are displayed in first box. After dragging one element to second box , the same element is cloned in first box and dragged element will be included to second box . With this Id all elements are displayed as they are. Plugin work basic at the moment, in future there will be some extra stuff.
Example Code Usage for displaying settings Back-end
$cmb_demo->add_field( array( 'name' => 'Drag and Drop field', 'id' => '_cmb2_drag_and_drop', 'type' => 'cmb2_drag_and_drop',
'options' => array( 'image-0' => 'Image 0', 'image-1' => 'Image 1', 'image-2' => 'Image 2', 'image-3' => 'Image 3', ),
Code Example to display List in front end
Because field type uses ajax for save you have to use other way to display settings, as example Below
$cool_options = get_option('drag_and_drop_option'); $data_array = json_decode($cool_options, TRUE); print_r($data_array);
Wordpress CMB2 Drag And Drop Clone Type Field
git clone https://github.com/Freelancer-Martin/Wordpress-CMB2-Drag-and-Drop-Clone-type-field.git