Skip to content

Instantly share code, notes, and snippets.

@amdrew
amdrew / gist:ef463c1377d3cb689f77
Last active August 29, 2015 14:09
EDD Wish Lists + EDD Favorites + Marketify theme
<?php
function sumobi_marketify_edd_favorites() {
// remove the button from the default position. Marketify adds there's further below
remove_action( 'edd_purchase_link_top', 'edd_favorites_load_link' );
// remove the wish list button from Marketify's custom location
remove_action( 'marketify_single_download_content_after', 'edd_wl_load_wish_list_link' );
@amdrew
amdrew / gist:5e9a2d02c684d3dc1643
Last active August 29, 2015 14:08
Easy Digital Downloads - changing the tag slug
<?php
function sumobi_edd_download_tag_args( $tag_labels ) {
$slug = defined( 'EDD_SLUG' ) ? EDD_SLUG : 'downloads';
// modify the "the-new-category-label" below to your liking
$tag_labels['rewrite'] = array('slug' => $slug . '/the-new-tag-label', 'with_front' => false, 'hierarchical' => true );
return $tag_labels;
}
@amdrew
amdrew / gist:3d3e932fddc9c36abc87
Last active August 29, 2015 14:08
AffiliateWP + WooCommerce - Add link through to user's profile screen from the reference column of the referrals page
<?php
/**
* Add link through to user's profile screen from the reference column of the referrals page
*/
function affwp_custom_wc_referrals_user_link( $reference, $referral ) {
if ( ! ( 'woocommerce' == $referral->context || class_exists( 'WC_Order' ) ) ) {
return $reference;
}
@amdrew
amdrew / gist:c48d40e13e4326c289eb
Created November 4, 2014 22:51
Easy Digital Downloads - Add the customer's username to the payment's "Customer Details" section and link through to their user profile
<?php
/**
* Easy Digital Downloads - Add the customer's username to the payment's "Customer Details" section and link through to their profile
*/
function sumobi_edd_customer_details_username( $payment_id ) {
$user_info = edd_get_payment_meta_user_info( $payment_id );
$customer_id = $user_info['id'];
if ( ! $customer_id ) {
@amdrew
amdrew / gist:4fb982bfeeb2e7cce0ad
Created November 3, 2014 03:27
AffiliateWP - When manually adding a new affiliate, send the newly created affiliate the approval email
<?php
/**
* Send the affiliate the application accepted email when manually adding an affiliate
*/
function affwp_custom_process_add_affiliate( $data ) {
if ( empty( $data['user_id'] ) ) {
return false;
}
@amdrew
amdrew / gist:f84a1662af47af18bfb8
Created October 27, 2014 01:18
AffiliateWP - brand the application accepted email
<?php
/**
* Append more information to the application success email message
*/
function affwp_custom_application_accepted_message( $message, $args ) {
$message = sprintf( __( "Congratulations %s!\n\n", "affiliate-wp" ), affiliate_wp()->affiliates->get_affiliate_name( $args['affiliate_id'] ) );
$message .= sprintf( __( "Your affiliate application on %s has been accepted!\n\n", "affiliate-wp" ), home_url() );
$message .= sprintf( __( "Log into your affiliate area at %s\n\n", "affiliate-wp" ), get_permalink( affiliate_wp()->settings->get( 'affiliates_page' ) ) );
<?php
function sumobi_shopfront_remove_logo_at_checkout() {
if ( edd_is_checkout() ) {
add_filter( 'shopfront_header_output', 'sumobi_get_checkout_header' );
}
}
add_action( 'template_redirect', 'sumobi_shopfront_remove_logo_at_checkout', 100 );
@amdrew
amdrew / gist:a2da5a4c5f02f525d0e3
Last active August 29, 2015 14:07
Easy Digital Downloads - Hide product notes from appearing on the purchase confirmation page and email
<?php
/**
* Remove product notes for specific downloads
*/
function sumobi_edd_remove_product_notes( $notes, $download_id ) {
// enter the download IDs you'd like to exclude into this array
$downloads_to_exclude = array( 509, 104, 435 );
if ( in_array( $download_id, $downloads_to_exclude ) ) {
@amdrew
amdrew / gist:3fb06f8116fdefd4127c
Created October 16, 2014 23:09
AffiliateWP - unset the Website URL field on the registration form so it is no longer required
<?php
function affwp_custom_required_fields( $required_fields ) {
unset( $required_fields['affwp_user_url'] );
return $required_fields;
}
add_filter( 'affwp_register_required_fields', 'affwp_custom_required_fields' );
@amdrew
amdrew / edd.php
Last active August 29, 2015 14:07
AffiliateWP - Disable referrals on specific product categories in WooCommerce or Easy Digital Downloads
<?php
/**
* Disable referrals on specific product categories in Easy Digital Downloads
*/
function affwp_custom_edd_disable_referrals_on_categories( $referral_amount, $affiliate_id, $amount, $reference, $product_id ) {
// Array of categories to disable referrals for. Separate by a comma and use either the term name, term_id, or slug
$disabled_categories = array( 'category-one', 5 );