| 1 |
<?php |
| 2 |
/** |
| 3 |
* Charitable Template Hooks. |
| 4 |
* |
| 5 |
* Action/filter hooks used for Charitable functions/templates |
| 6 |
* |
| 7 |
* @package Charitable/Functions/Templates |
| 8 |
* @author Eric Daams |
| 9 |
* @copyright Copyright (c) 2022, Studio 164a |
| 10 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 11 |
* @since 1.0.0 |
| 12 |
* @version 1.5.0 |
| 13 |
*/ |
| 14 |
|
| 15 |
// Exit if accessed directly. |
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Add custom CSS to the <head>. |
| 22 |
* |
| 23 |
* @see charitable_template_custom_styles() |
| 24 |
*/ |
| 25 |
add_filter( 'wp_head', 'charitable_template_custom_styles' ); |
| 26 |
|
| 27 |
/** |
| 28 |
* Single campaign, before content. |
| 29 |
* |
| 30 |
* @see charitable_template_campaign_description() |
| 31 |
* @see charitable_template_campaign_summary() |
| 32 |
*/ |
| 33 |
add_action( 'charitable_campaign_content_before', 'charitable_template_campaign_description', 4 ); |
| 34 |
add_action( 'charitable_campaign_content_before', 'charitable_template_campaign_summary', 6 ); |
| 35 |
|
| 36 |
/** |
| 37 |
* Single campaign, campaign summary. |
| 38 |
* |
| 39 |
* @see charitable_template_campaign_percentage_raised() |
| 40 |
* @see charitable_template_campaign_donation_summary() |
| 41 |
* @see charitable_template_campaign_donor_count() |
| 42 |
* @see charitable_template_campaign_time_left() |
| 43 |
* @see charitable_template_donate_button() |
| 44 |
*/ |
| 45 |
add_action( 'charitable_campaign_summary', 'charitable_template_campaign_percentage_raised', 4 ); |
| 46 |
add_action( 'charitable_campaign_summary', 'charitable_template_campaign_donation_summary', 6 ); |
| 47 |
add_action( 'charitable_campaign_summary', 'charitable_template_campaign_donor_count', 8 ); |
| 48 |
add_action( 'charitable_campaign_summary', 'charitable_template_campaign_time_left', 10 ); |
| 49 |
add_action( 'charitable_campaign_summary', 'charitable_template_donate_button', 12 ); |
| 50 |
|
| 51 |
/** |
| 52 |
* Single campaign, after content. |
| 53 |
* |
| 54 |
* @see charitable_template_campaign_donation_form_in_page() |
| 55 |
*/ |
| 56 |
add_action( 'charitable_campaign_content_after', 'charitable_template_campaign_donation_form_in_page', 4 ); |
| 57 |
|
| 58 |
/** |
| 59 |
* Campaigns loop, right at the start. |
| 60 |
* |
| 61 |
* @see charitable_template_campaign_loop_add_modal() |
| 62 |
*/ |
| 63 |
add_action( 'charitable_campaign_loop_before', 'charitable_template_campaign_loop_add_modal' ); |
| 64 |
add_action( 'charitable_campaign_loop_before', 'charitable_template_responsive_styles', 10, 2 ); |
| 65 |
|
| 66 |
/** |
| 67 |
* Campaigns loop, before title. |
| 68 |
* |
| 69 |
* @see charitable_template_campaign_loop_thumbnail() |
| 70 |
*/ |
| 71 |
add_action( 'charitable_campaign_content_loop_before_title', 'charitable_template_campaign_loop_thumbnail', 10 ); |
| 72 |
|
| 73 |
/** |
| 74 |
* Campaigns loop, after the main title. |
| 75 |
* |
| 76 |
* @see charitable_template_campaign_description() |
| 77 |
* @see charitable_template_campaign_progress_bar() |
| 78 |
* @see charitable_template_campaign_loop_donation_stats() |
| 79 |
* @see charitable_template_campaign_donate_link() |
| 80 |
* @see charitable_template_campaign_loop_more_link() |
| 81 |
*/ |
| 82 |
add_action( 'charitable_campaign_content_loop_after', 'charitable_template_campaign_description', 4 ); |
| 83 |
add_action( 'charitable_campaign_content_loop_after', 'charitable_template_campaign_progress_bar', 6 ); |
| 84 |
add_action( 'charitable_campaign_content_loop_after', 'charitable_template_campaign_loop_donation_stats', 8 ); |
| 85 |
add_action( 'charitable_campaign_content_loop_after', 'charitable_template_campaign_loop_donate_link', 10, 2 ); |
| 86 |
add_action( 'charitable_campaign_content_loop_after', 'charitable_template_campaign_loop_more_link', 10, 2 ); |
| 87 |
|
| 88 |
/** |
| 89 |
* Donation receipt, after the page content (if there is any). |
| 90 |
* |
| 91 |
* @see charitable_template_donation_receipt_summary() |
| 92 |
* @see charitable_template_donation_receipt_offline_payment_instructions() |
| 93 |
*/ |
| 94 |
add_action( 'charitable_donation_receipt', 'charitable_template_donation_receipt_summary', 4 ); |
| 95 |
add_action( 'charitable_donation_receipt', 'charitable_template_donation_receipt_offline_payment_instructions', 6 ); |
| 96 |
add_action( 'charitable_donation_receipt', 'charitable_template_donation_receipt_details', 8 ); |
| 97 |
|
| 98 |
/** |
| 99 |
* Footer, right before the closing body tag. |
| 100 |
* |
| 101 |
* @see charitable_template_campaign_modal_donation_window() |
| 102 |
*/ |
| 103 |
add_action( 'wp_footer', 'charitable_template_campaign_modal_donation_window' ); |
| 104 |
|
| 105 |
/** |
| 106 |
* Add the login form before the donation form, outside the <form> tags |
| 107 |
* |
| 108 |
* @see charitable_template_donation_form_login() |
| 109 |
*/ |
| 110 |
add_action( 'charitable_donation_form_before', 'charitable_template_donation_form_login', 4 ); |
| 111 |
|
| 112 |
/** |
| 113 |
* Donation form, before the donor fields. |
| 114 |
* |
| 115 |
* @see charitable_template_donation_form_donor_details() |
| 116 |
*/ |
| 117 |
add_action( 'charitable_donation_form_donor_fields_before', 'charitable_template_donation_form_donor_details', 6 ); |
| 118 |
|
| 119 |
/** |
| 120 |
* Add a link to the login form after the registration form. |
| 121 |
* |
| 122 |
* @see charitable_template_form_login_link() |
| 123 |
*/ |
| 124 |
add_action( 'charitable_user_registration_after', 'charitable_template_form_login_link' ); |
| 125 |
|