Skip to content

Instantly share code, notes, and snippets.

View SeanChDavis's full-sized avatar
👋
Reach out.

Sean Christopher Davis SeanChDavis

👋
Reach out.
View GitHub Profile
@SeanChDavis
SeanChDavis / gist:3f306e53d940ea248712
Last active August 29, 2015 14:05
EDD Download Thumbnail in Download Details Widget
function sd_edd_download_details_widget_thumbnail( $instance ) {
// get the ID of the current post
$post_id = get_the_ID();
// grab featured image of the appropriate download
if ( 'current' == $instance['download_id'] ) {
echo get_the_post_thumbnail( $post_id );
} else {
echo get_the_post_thumbnail( $instance['download_id'] );
@SeanChDavis
SeanChDavis / gist:8fd7eea76174168c53e7
Last active August 29, 2015 14:05
EDD Required Address Fields But Not on Free Downloads
<?php
/**
* Mark address field required except for free downloads
*/
function pw_edd_purchase_form_required_fields( $required_fields ) {
$cart_total = edd_get_cart_total();
$required_fields['card_address'] = array(
'error_id' => 'invalid_adress',
'error_message' => __( 'Please enter your address.', 'edd' )
);
@SeanChDavis
SeanChDavis / gist:44645b4e7a7ea23d6957
Created August 15, 2014 01:06
EDD Disable Automatic Output of Download After Content
<?php remove_action( 'edd_after_download_content', 'edd_append_purchase_link' ); ?>
@SeanChDavis
SeanChDavis / gist:1c7f4bc1630bc63672bd
Created August 20, 2014 04:39
Rebuild EDD [downloads] shortcode in theme/plugin
<?php
/*
* remove the default [downloads] shortcode from Easy Digital Downloads
* and then rebuild it with full control
*/
// remove default EDD [downloads] shortcode
remove_shortcode( 'downloads' );
// rebuild [downloads] shortcode
@SeanChDavis
SeanChDavis / gist:ce740c542ab99274f877
Last active August 29, 2015 14:05
EDD Edit Required Fields
<?php // DON'T COPY THIS LINE
/*
* Remove Billing State from required list
*/
function custom_edd_purchase_form_required_fields( $required_fields ) {
unset( $required_fields['card_state'] );
return $required_fields;
}
add_filter( 'edd_purchase_form_required_fields', 'custom_edd_purchase_form_required_fields' );
@SeanChDavis
SeanChDavis / gist:068c9deee5223f46981f
Last active August 29, 2015 14:05
EDD Software Licensing Admin Notice Based on License State/Existence
<?php
/**
* If the license is not entered or is not valid, show notice. For use with EDD Software Licensing
*
* CHANGE sample_ TO YOUR FUNCTION PREFIX
*
* https://easydigitaldownloads.com/extensions/software-licensing/?ref=184
*/
function sample_admin_notice() {
@SeanChDavis
SeanChDavis / gist:5abb86d10a45dcda1d0a
Created August 24, 2014 21:32
EDD Purchase Receipt - No Download Links
<?php
/**
* This template is used to display the purchase summary with [edd_receipt]
*/
global $edd_receipt_args, $edd_options;
$payment = get_post( $edd_receipt_args['id'] );
$meta = edd_get_payment_meta( $payment->ID );
$cart = edd_get_payment_meta_cart_details( $payment->ID, true );
$user = edd_get_payment_meta_user_info( $payment->ID );
@SeanChDavis
SeanChDavis / gist:7bb3390fbee233f8612a
Last active August 29, 2015 14:06
EDD Lattice Custom Social Icons Function
/**
* custom function for footer icons
*/
function custom_lattice_icons() {
$twitter = get_theme_mod( 'lattice_twitter' );
$facebook = get_theme_mod( 'lattice_facebook' );
$instagram = get_theme_mod( 'lattice_instagram' );
$gplus = get_theme_mod( 'lattice_gplus' );
if ( $twitter || $facebook || $instagram || $gplus ) {
@SeanChDavis
SeanChDavis / gist:61553657a2c07261bdad
Last active August 29, 2015 14:06
Volatyl for EDD Override Single Download Template
<?php
/**
* override single download template
*/
global $options;
// Custom filter
$single_tags_text = apply_filters('single_tags_text', __('Tags: ', 'volatyl'));
get_header();
@SeanChDavis
SeanChDavis / gist:68dcb7db5cba044ba1b1
Last active August 29, 2015 14:06
EDD Move Points & Rewards Single Download Output
if ( class_exists( 'EDD_Points_Renderer' ) ) {
global $edd_points_render;
remove_action( 'edd_before_download_content', array( $edd_points_render, 'edd_points_message_content' ), 10 );
add_action( 'edd_after_download_content', array( $edd_points_render, 'edd_points_message_content' ), 0 );
function custom_add_instructions() { ?>
<p><strong><span style="color: #ff0000;">2. Use the drop down below to select the template you desire.</span></strong></p>
<?php
}
add_action( 'edd_after_download_content', 'custom_add_instructions', 1 );
}