Blogs for Bands Development

gigCal_gigs_extraFields

This filter should prove to be pretty useful. It will allow you to define extra, custom fields to add to every gig’s form. Below is an example of a hook. You’ll need to return an array of all of the fields, defined in the format below. So far, the types of fields below are the only options you have. Let me know how I can expand this.

function extraFields_hook($fields) {
    return array_merge($fields, array(
        array(
            'type' => 'text',
            'name' => 'opening-band',
            'label' => 'Opening Band',
            'default' => 'Paul and Storm',
        ),
        array(
            'type' => 'textarea',
            'name' => 'directions',
            'label' => 'Directions',
            'default' => 'Left at Albuquerque',
        ),
        array(
            'type' => 'select',
            'name' => 'smoking',
            'label' => 'Smoking?',
            'default' => 'outside',
            'options' => array(
                'no' => 'No',
                'yes' =>
                'Yes',
                'outside' => 'You can smoke outside'
            ),
        ),
        array(
            'type' => 'radio',
            'name' => 'smoking',
            'label' => 'Smoking?',
            'default' => 0,
            'options' => array('No', 'Yes'),
        ),
        array(
            'type' => 'checkbox',
            'name' => 'canceled',
            'label' => 'Canceled Gig',
            'default' => array(0,3),
            'options' => array(
                'No',
                'Yes',
                'Maybe',
                'Sorta'
            ),
        ),
    ));
}

Note: for all of the types that take “options”, you can pass an associative array or an ordered array. The array key will always be the value saved in the custom field, however.

Leave a Comment

  • Recent Tags

    All Updates RSS

  • Blog at WordPress.com
    Prologue theme by Automattic

  • Order kamagra 100mg buy priligy online usa