Support » Plugin: Charitable - Donation Plugin » Regarding adding a custom check box field to charitable plugin donation form

  • bharathjinka09

    (@bharathjinka09)


    This is my functions.php. I have added the custom checkbox using the above code present in your github. But i am not able to display a danamojo donate button after clicking the checkbox. It should display it in donation receipt after submitting and should also save in database. For example, if a user or donor is an Indian, then he will check the checkbox and then the button will gets displayed below the checkbox. Then he will pay the donation amount. After that the donation amount and the Indian value in the checkbox should be saved and displayed in the donation receipt. The checkbox should be added after phone number text box. Thank you.

    This is the gist link = Gist Link

    <?php
    /**
    * Core functions and definitions for Reach Theme.
    *
    * @package Reach
    */

    require_once( ‘inc/class-reach-theme.php’ );

    /**
    * Start the theme.
    */
    reach_get_theme();

    /**
    * Set the content width based on the theme’s design and stylesheet.
    */
    if ( ! isset( $content_width ) ) {
    $content_width = 640; /* pixels */
    }

    /**
    * Define whether we’re in debug mode.
    *
    * This is set to false by default. If set to true,
    * scripts and stylesheets are NOT cached or minified
    * to make debugging easier.
    */
    if ( ! defined( ‘REACH_DEBUG’ ) ) {
    define( ‘REACH_DEBUG’, false );
    }

    /**
    * Return the one true instance of the Reach_Theme.
    *
    * @return Reach_Theme
    * @since 1.0.0
    */
    function reach_get_theme() {
    return Reach_Theme::get_instance();
    }

    add_action(‘wp_enqueue_scripts’, ‘load_js_assets’);

    function ed_charitable_register_new_checkbox_field() {

    /**
    * Define a new checkbox field.
    */
    $field = new Charitable_Donation_Field( ‘new_checkbox_field’, array(
    ‘label’ => __( ‘Indian’, ‘charitable’ ),
    ‘data_type’ => ‘user’,
    ‘donation_form’ => array(
    ‘type’ => ‘checkbox’,
    ‘show_after’ => ‘phone’,
    ‘required’ => true,
    ‘name’=> ‘indian’,
    ‘id’ => ‘myCheck’,
    ‘onClick’=>’myFunction()’,
    ),
    ‘admin_form’ => true,
    ‘show_in_meta’ => true,
    ‘show_in_export’ => true,
    ’email_tag’ => array(
    ‘description’ => __( ‘Indian or not’ , ‘charitable’ ),
    ),
    ) );

    /**
    * Register the checkbox field.
    */
    charitable()->donation_fields()->register_field( $field );
    }

    add_action( ‘init’, ‘ed_charitable_register_new_checkbox_field’ );

    The page I need help with: [log in to see the link]

  • The topic ‘Regarding adding a custom check box field to charitable plugin donation form’ is closed to new replies.