Skip to content

Instantly share code, notes, and snippets.

@ericnicolaas
Created March 1, 2022 08:01
Show Gist options
  • Save ericnicolaas/c4feb9d640105a8708bdb01362d021c2 to your computer and use it in GitHub Desktop.
Save ericnicolaas/c4feb9d640105a8708bdb01362d021c2 to your computer and use it in GitHub Desktop.
Charity Home theme donation form override
<?php
/**
* This template will override the default donation form theme template in Charity Home,
* which does not fully support all Charitable extensions.
*/
if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
$form = $view_args['form'];
$user_fields = $form->get_user_fields();
$user = wp_get_current_user();
$use_ajax = 'make_donation' == $form->get_form_action() && (int) Charitable_Gateways::get_instance()->gateways_support_ajax();
$form_id = isset( $view_args['form_id'] ) ? $view_args['form_id'] : 'charitable-donation-form';
if ( ! $form ) {
return;
}
?>
<form method="post" id="<?php echo esc_attr( $form_id ) ?>" class="charitable-donation-form charitable-form" data-use-ajax="<?php echo esc_attr( $use_ajax ) ?>">
<?php
/**
* @hook charitable_form_before_fields
*/
do_action( 'charitable_form_before_fields', $form ) ?>
<div class="tpath-charitable-form-wrapper">
<div class="charitable-form-fields cf">
<?php $form->view()->render(); ?>
</div><!-- .charitable-form-fields -->
</div>
<?php
/**
* @hook charitable_form_after_fields
*/
do_action( 'charitable_form_after_fields', $form );
?>
<div class="charitable-form-field charitable-submit-field">
<button class="button button-primary" type="submit" name="donate"><?php esc_attr_e( 'Donate', 'charity-home' ) ?></button>
<div class="charitable-form-processing" style="display: none;">
<img src="<?php echo charitable()->get_path( 'assets', false ) ?>/images/charitable-loading.gif" width="60" height="60" alt="<?php esc_attr_e( 'Loading&hellip;', 'charity-home' ) ?>" />
</div>
</div>
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment