Skip to content

Instantly share code, notes, and snippets.

View gspice's full-sized avatar

Ginger Coolidge gspice

  • GSC Solutions LLC
  • Lincoln City, Oregon
View GitHub Profile
@rickalday
rickalday / givewp_pdf_cutom_tags.php
Last active December 10, 2025 21:14
Sample function to include form custom field data in GiveWP PDF Receipts
<?php
function givewp_pdf_cutom_tags( $template_content, $args ) {
//$donor_info = give_get_payment_meta_user_info( $args['donation_id'] );
$post = get_post($args['donation_id']);
if ($post->post_parent) {
$post_id = $post->post_parent;
} else {
$post_id = $args['donation_id'];
}
@rickalday
rickalday / give_export_gift_aid.php
Last active August 1, 2025 17:29
Export Gift Aid data in Donation History Export Tool
<?php
function give_export_gift_aid() {
?>
<li>
<label for="give-export-payment-gift_aid">
<input type="checkbox" checked name="give_give_donations_export_option[gift_aid]" id="give-export-gift_aid"><?php _e( 'Gift Aid', 'give' ); ?>
</label>
</li>
<?php
@rickalday
rickalday / unrequire_billing_block_fields.php
Created March 11, 2025 19:47
Unrequire billing address block field for US in GiveWP visual builder forms
<?php
add_filter('give_get_country_locale', 'give_custom_requirements');
function give_custom_requirements() {
$countries = array(
'US' => [
'state' => [
'required' => false,
],
'address1' => [
@rickalday
rickalday / export_gift_aid_names.php
Created November 29, 2024 23:32
Export Gift Aid First and Last Names
<?php
add_filter( 'give_gift_aid_export_get_data', static function($data) {
foreach($data as $key => $datakey){
$first_name = give_get_payment_meta($datakey['gift_aid_donation_id'], '_give_donor_billing_first_name', true);
$last_name = give_get_payment_meta($datakey['gift_aid_donation_id'], '_give_donor_billing_last_name', true);
$data[$key]['gift_aid_first_name'] = $first_name;
$data[$key]['gift_aid_last_name'] = $last_name;
}
return $data;
@rickalday
rickalday / v3-add-referral-url-to-donation-meta.php
Last active November 11, 2025 21:03
Adds referral URL to donations made on Visual Builder forms
<?php
// Create a cookie to store the parent window referral url
add_action( "givewp_donation_form_enqueue_scripts", function () {
?>
<script>
document.addEventListener("DOMContentLoaded", function () {
createCookie("givewp_referrer", window.parent.frames.top.document.referrer, "1");
// Function to create the cookie
@rickalday
rickalday / GiveWP custom Tributes email tag
Created January 17, 2020 20:29
GiveWP custom Tributes email tag
function add_give_honoree_name_tag() {
give_add_email_tag(
array(
'tag' => 'honoree_fullname', // The tag name.
'desc' => __( 'The full name of the honoree.', 'give-tributes' ),
'func' => 'custom_tribute_tag_honoree_fullname', // Callback to function below.
'context' => 'donation', // This tag can be for both admin and donor notifications.
'is_admin' => false, // default is false. This is here to simply display it as an option.
)
);
@carasmo
carasmo / readmore.php
Created March 31, 2016 14:25
Read More outside the paragraph
<?php
//don't include this
/** ====================================================================================
* Break more link outside the paragraph in the loop on all archives (home, archives, search, etc)
==================================================================================== **/
function yourprefix_excerpt_more_link() {
@scottopolis
scottopolis / apppresser-device-push
Last active June 17, 2018 20:19
Send AppPresser Push Notification only to certain devices
/*
* Send notifications only to certain devices
*/
// Change this hook
add_action( 'save_post', 'push_to_devices' );
function push_to_devices() {
// this should be an array of user IDs that you want to send the pushes too. AppPresser saves device IDs if the app user is a logged in member of your WordPress site, for example in BuddyPress. This will not work unless the user has logged in through your app.
@amdrew
amdrew / 1.php
Created June 1, 2014 02:24
AffiliateWP - Send the affiliate registration admin email to different email address, or multiple email addresses.
<?php
/**
* Send admin notification to a different email address
*/
function affwp_custom_registration_admin_email( $email ) {
// add the email here
$email = '[email protected]';
return $email;