Home

Awesome

CMB2 custom field "animation"

Custom field for CMB2 to store Animate.css animations.

example

add_action( 'cmb2_admin_init', 'cmb2_animation_metabox' );
function cmb2_animation_metabox() {

	$prefix = 'your_prefix_demo_';

	$cmb_demo = new_cmb2_box( array(
		'id'            => $prefix . 'metabox',
		'title'         => __( 'Test Metabox', 'cmb2' ),
		'object_types'  => array( 'page', 'post' ), // Post type
	) );

	$cmb_demo->add_field( array(
		'name'          => __( 'Test Animation', 'cmb2' ),
		'desc'          => __( 'Field description (optional)', 'cmb2' ),
		'id'            => $prefix . '_animation',
		'type'          => 'animation',
		// 'groups'        => array( 'entrances', 'exits' ), // By default all groups are enabled
		'preview'       => true // "Preview" text where animations are applied on click the play button
		'custom_groups' => array( 
            // Format: '{group}' => '{group_label}'
            'custom_group' => __( 'Custom Group', 'cmb2' ),
        ),
		'custom_animations' => array( 
		    // Format: '{group}' => array( '{animation}' => '{animation_label}' )
            'entrances' => array(
                'custom_entrance' => __( 'Custom Entrance', 'cmb2' ),
            ), 
            'custom_group'  => array(
                'custom_animation' => __( 'Custom Animation on a custom group', 'cmb2' ),
            ) 
		),
	) );

}

Available groups

Examples:

'groups'        => array( 'seekers' )                   // Enable seekers
'groups'        => array( 'entrances' )                 // Enable all entrances
'groups'        => array( 'fading_exits', 'specials' )  // Enable fading exits and specials

Changelog

1.0.2

1.0.1

1.0.0