Home / Admin / Add Radio Boxes To Donation Form
Duplicate Snippet

Embed Snippet on Your Site

Add Radio Boxes To Donation Form

David Bisset PRO
<10
Code Preview
php
<?php
/**
 * Add a collection of radio selections to the donation form.
 *
 * This snippet only works in Charitable 1.5 or above.
 *
 */
function wpchar_charitable_register_new_radios_field() {
	
    if ( ! class_exists("Charitable_Donation_Field" ) ) {
	return;
    };
	
    /**
     * Define a new radio box field.
     */
    $field = new Charitable_Donation_Field( 'new_radios_field', array(
        'label' => __( 'New Radios Boxes Field', 'charitable' ),
        'data_type' => 'user',
        'donation_form' => array(
            'type' => 'radio',
            'show_before' => 'phone',
            'required'   => false,
            'options' => array (
                 'option_1_value' => 'Option One',
                 'option_2_value' => 'Option Two',
                 'option_3_value' => 'Option Three',
	     ),
        ),
        'admin_form' => true,
        'show_in_meta' => true,
        'show_in_export' => true,
        'email_tag' => array(
            'description' => __( 'The new radios field' , 'charitable' ),
        ),
    ) );
    /**
     * Register the radios field.
     */
    charitable()->donation_fields()->register_field( $field );
}
add_action( 'init', 'wpchar_charitable_register_new_radios_field' );

Comments

Add a Comment