Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter buckindb

    (@buckindb)

    Here is the snippet from my functions.php:

    add_action( 'cn_metabox', 'cn_register_merit_badge_metabox' );
     
    function cn_register_merit_badge_metabox() {
    
       $atts = array(
    		'title'    => 'Merit Badge Counselor',
    		'id'       => 'merit_badge_counselor',
    		'context'  => 'normal',
    		'priority' => 'core',
    		'fields'   => array(
    			array(
                   'name'        => 'Merit Badges',    // Change this field name to something which applies to you project.
                   'show_label'  => TRUE,             	// Whether or not to display the 'name'. Changing it to false will suppress the name.
                   'id'          => 'merit_badges', 	// Change this so it is unique to you project. Each field id MUST be unique.
                   'type'        => 'checkboxgroup',  	// This is the field type being added.
                   'options'     => Merit_Badge::merit_badge_names(),
                   'default'     => '',                // This is the default selected option. Leave blank for none.
                ),
    		),
    	);
    
    	cnMetaboxAPI::add( $atts );
    }

    I have a static class Merit_Badge, that maintains a list of merit badges for our scout troop. The static method, returns an associative array of merit badge ids and names.

    Thanks!

Viewing 1 replies (of 1 total)