Skip to content

Instantly share code, notes, and snippets.

View ericnicolaas's full-sized avatar
🎯
Focusing

Eric Daams ericnicolaas

🎯
Focusing
View GitHub Profile
@ericnicolaas
ericnicolaas / charitable-checkout-default-colour
Last active October 24, 2015 02:40
Set the default colour used by Charitable in the Checkout theme by Array.
<?php
/**
* Set the default colour used by Charitable.
*
* @return string
*/
function checkout_charitable_default_colour() {
return '#37BF91';
}
@ericnicolaas
ericnicolaas / charitable-change-campaign-link-in-loop
Last active October 26, 2015 01:28
Charitable campaign link in loop template
@ericnicolaas
ericnicolaas / stats.php
Created November 3, 2015 13:34
Reach child theme stats.php
<?php
/**
* Campaign stats.
*
* This is a variation of the default template provided in Reach. Instead of showing the percentage funded, it shows
* the actual funded amount. It also shows the goal amount.
*
* This should be saved to your-child-theme/charitable/campaign-loop/stats.php
*
* @package Reach
@ericnicolaas
ericnicolaas / donors.php
Last active November 7, 2015 20:53
Charitable donor widget with organisation & website
<?php
/**
* This template lets you override the Donors widget output in Charitable, by adding the donor
* name and organisation to the widget.
*
* Save it to yourtheme/charitable/widgets/donors.php
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@ericnicolaas
ericnicolaas / charitable-custom-styles-cache-delete.php
Created December 3, 2015 02:40
Delete custom styles cache in Charitable -- for testing purposes
/**
* Add custom styles to the <head> section.
*
* This is used on the wp_head action.
*
* @return void
* @since 1.2.0
*/
function charitable_template_custom_styles() {
if ( ! apply_filters( 'charitable_add_custom_styles', true ) ) {
@ericnicolaas
ericnicolaas / shortcode-profile.php
Created December 3, 2015 11:52
Save custom profile fields.
<?php
/**
* Process shortcode submission.
*
* @since Astoundify Crowdfunding 0.8
*
* @return void
*/
function atcf_shortcode_profile_info_process() {
global $edd_options, $post;
@ericnicolaas
ericnicolaas / Charitable-Roadmap.php
Last active December 30, 2015 23:50
Charitable Roadmap - what happened in 2015 and what's to come in 2016.
<?php
/**
* After more than a year in development, we finally
* launched Charitable on August 19.
*
* @see https://www.wpcharitable.com/charitable-now-available-on-wordpress-org/
*/
did_action( 'charitable_launch' );
/**
@ericnicolaas
ericnicolaas / function.php
Created December 31, 2015 03:10
Add Charitable profile fields to admin user profiles
<?php
function pp_add_user_profile_fields( $user ) {
$skip = array( 'first_name', 'last_name', 'user_email', 'description' );
$switch_keys = array(
'address' => 'donor_address',
'address_2' => 'donor_address_2',
'city' => 'donor_city',
'state' => 'donor_state',
@ericnicolaas
ericnicolaas / gist:ace81509b63edaaa1caa
Created January 6, 2016 00:34
Appthemer Crowdfunding - Automatically approve campaigns
/**
* This function will automatically set the status of a newly
* submitted campaign to 'publish'.
*/
function franklin_auto_approve_campaign( $campaign, $submitted, $status ) {
if ( 'pending' == $status ) {
wp_update_post( array(
'ID' => $campaign,
'post_status' => 'publish'
@ericnicolaas
ericnicolaas / gist:cfbd71a12a116eda5be3
Created January 28, 2016 07:13
4-column campaign grid
.campaign-grid-4 .campaign {
width: 23.5%;
}
.campaign-grid-4 .campaign:nth-child(4n+4) {
margin-right: 0;
}