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 / file.php
Created May 16, 2017 16:03
EDD SL disable renewal discount for specific product
<?php // DO NOT COPY THIS LINE
/*
* Disables renewal discount for specific product
*/
function pw_edd_disable_product_renewal_discount( $renewal_discount, $license_id ) {
$license = edd_software_licensing()->get_license( $license_id );
// replace 40 with relevant ID
if( 40 == $license->download_id ) {
@SeanChDavis
SeanChDavis / file.php
Created March 10, 2017 16:54
EDD Checkout Account Creation Notice
<?php // DO NOT COPY THIS LINE
function sd_checkout_account_creation_notice() {
?>
<div class="checkout-account-notice" style="color: #8a6d3b; background: #fcf8e3; border-color: #faebcc; padding: 10px; margin-bottom: 1.6em;">This is a warning message for account creation.</div>
<?php
}
add_action( 'edd_register_account_fields_before', 'sd_checkout_account_creation_notice' );
@SeanChDavis
SeanChDavis / file.php
Created February 17, 2017 16:11
EDD Auto Register Replace Login Link
<?php // DO NOT COPY THIS LINE
// replace the default WordPress login link in Auto Register
function custom_edd_auto_register_login( $login_url ) {
$login_url = str_replace(
'http://yoursite.com/wp-login.php',
'http://yoursite.com/sign-in',
$login_url
);
@SeanChDavis
SeanChDavis / file.php
Last active July 4, 2017 19:14
EDD SL - Update the updater to use Item ID
<?php
/**
* theme-updater.php
*/
// Find this block of code (at the top of the class)
$config = array(
'remote_api_url' => 'https://easydigitaldownloads.com', // Site where EDD is hosted
'item_name' => 'Theme Name', // Name of theme
@SeanChDavis
SeanChDavis / file.php
Created December 30, 2016 04:44
EDD SL Purchase History Overwrite
<?php // DO NOT COPY THIS LINE
function custom_edd_sl_override_history_content( $content ) {
if( empty( $_GET['action'] ) || 'manage_licenses' != $_GET['action'] ) {
return $content;
}
if( empty( $_GET['payment_id'] ) ) {
return $content;
}
if( ! in_the_loop() ) {
@SeanChDavis
SeanChDavis / file.php
Created December 28, 2016 18:28
EDD Auto Register Add Password Notice To Email
<?php // DO NOT COPY THIS LINE
function custom_edd_auto_register_email_body( $email ) {
$new_email = $email . "\n(Your password is temporary. Please change immediately.)";
return $new_email;
}
add_filter( 'edd_auto_register_email_body', 'custom_edd_auto_register_email_body' );
@SeanChDavis
SeanChDavis / file.csv
Created December 27, 2016 16:42
EDD CSV Coupon Importer Sample
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 15 columns, instead of 16 in line 1.
discount_name,code,type,starts,ends,status,uses,max uses,amount,min price,product requirements,product condition,is not global,is single use,
Discount 1,TESTCODE1,percentage,2012-11-01 01:01:01,2014-11-01 01:01:01,active,1,100,20,$10.00,0,0,0,1, ,
Discount 2,TESTCODE2,percentage,2012-11-01 01:01:01,2014-11-01 01:01:01,active,1,100,20%,10,8,0,0, ,
@SeanChDavis
SeanChDavis / file.php
Created December 21, 2016 16:07
Vendd Remove Post Excerpt Ellipses
<?php // DO NOT COPY THIS LINE
function custom_vendd_excerpt_more( $more ) {
return '</p><p class="continue-reading"><a class="more-link" href="' . get_permalink( get_the_ID() ) . '">' . get_theme_mod( 'vendd_read_more', __( 'Continue reading', 'vendd' ) ) . ' &rarr;</a></p>';
}
add_filter( 'excerpt_more', 'custom_vendd_excerpt_more', 99 );
@SeanChDavis
SeanChDavis / file.php
Last active December 17, 2016 05:19
Volatyl Display Thumbnails on Archives
<?php // DO NOT COPY THIS LINE
function vol_setup_thumb_dimensions() {
$width = get_option( 'thumbnail_size_w' );
$height = get_option( 'thumbnail_size_h' );
$crop = get_option( 'thumbnail_crop' ) ? true : false;
add_image_size( 'post-thumbnail', $width, $height, $crop );
}
add_action( 'after_setup_theme', 'vol_setup_thumb_dimensions', 20 );
@SeanChDavis
SeanChDavis / file.php
Last active June 27, 2019 22:38
EDD Edit New User Notification Login URL
<?php // DO NOT COPY THIS LINE. COPY THE 3 SECTIONS BELOW ... THEY ALL WORK TOGETHER.
/**
* EDD core uses a custom function called edd_new_user_notification() to build the
* email template used for new user notification emails. So first, we need to tell
* EDD core to STOP using that function.
*/
function custom_remove_new_user_notification() {
remove_action( 'edd_insert_user', 'edd_new_user_notification', 10, 2 );