Skip to content

Instantly share code, notes, and snippets.

View pippinsplugins's full-sized avatar

Pippin Williamson pippinsplugins

View GitHub Profile
<?php
/*
* Plugin Name: Custom EDD Checkout Fields
*/
// output our custom field HTML
function pippin_edd_custom_checkout_fields() {
?>
<p id="edd-phone-wrap">
<label class="edd-label" for="edd-phone"><?php _e('Telephone Number', 'pippin_edd'); ?><span class="edd-required-indicator">*</span></label>
@pippinsplugins
pippinsplugins / Filter Events
Created June 29, 2012 14:40 — forked from stompweb/filter-events.php
Filter events pre_get_posts
// Function to display only upcoming events for Sugar Events Calendar on the main Events archive.
function sc_filter_events( $query ) {
if( is_post_type_archive('sc_event') && (!is_admin()) ) {
$meta = array(
array(
'key' => 'sc_event_date_time',
'value' => time(),
@pippinsplugins
pippinsplugins / edd_download_comments.php
Created May 24, 2012 01:37
Adds support for comments to the "Downloads" post type
<?php
function modify_edd_product_supports($supports) {
$supports[] = 'comments';
return $supports;
}
add_filter('edd_download_supports', 'modify_edd_product_supports');
@pippinsplugins
pippinsplugins / gist:8653114
Last active September 10, 2017 10:20
Show $0.00 prices as "Free" in EDD.
<?php
/* Plugin Name: Custom Functions */
function pw_format_currency( $formatted, $currency, $price ) {
if( ! is_admin() && $price == 0.00 ) {
return 'Free';
}
return $formatted;
@pippinsplugins
pippinsplugins / gist:9201867
Created February 25, 2014 03:06
Simple example of how to use SCRIPT_DEBUG to load non-minified assets
<?php
// Use minified libraries if SCRIPT_DEBUG is turned off
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
wp_enqueue_script( 'my-script-handle', plugin_dir_url( __FILE__ ) . 'assets/my-file' . $suffix . '.js', array( 'jquery' ) );
@pippinsplugins
pippinsplugins / gist:8834900
Created February 5, 2014 22:46
Duplicates the EDD downloads pagination
<?php
/*
* Plugin Name: EDD Double Pagination
*/
function pw_edd_duplicate_pagination() {
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* Allows plugins to use their own update API.
*
* @author Easy Digital Downloads
* @version 1.6.13
@pippinsplugins
pippinsplugins / gist:4704632
Last active July 19, 2017 03:37
Add custom payment method icons to Easy Digital Downloads
<?php
/**
* Register the payment icon
*/
function pw_edd_payment_icon($icons) {
$icons['url/to/your/image/icon.png'] = 'Name of the Payment Method';
return $icons;
}
add_filter('edd_accepted_payment_icons', 'pw_edd_payment_icon');
<?php
add_filter( 'mailchimp_sync_subscriber_data', function( MC4WP_MailChimp_Subscriber $subscriber, $user ) {
$affiliate = affiliate_wp()->affiliates->get_by( 'user_id', $user->ID );
if( ! empty( $affiliate ) ) {
$subscriber->merge_fields['MERGE6'] = $affiliate->affiliate_id;
}
return $subscriber;
}, 10, 2 );
<?php
/*
* Plugin Name: Easy Digital Downloads - Daily Cron for Abandoned Payments
* Description: Checks for abandoned payments daily, instead of just weekly
* Author: Pippin Williamson
*/
/**
* Grab all pending payments older than one day