Created
November 24, 2014 19:45
-
-
Save amdrew/9f79c4d09a48dd1c945a to your computer and use it in GitHub Desktop.
Easy Digital Downloads + EDD Social Discounts. Remove sharing buttons for free downloads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * EDD Social Discounts - remove sharing buttons for free downloads | |
| */ | |
| function sumobi_edd_social_discount_display_share_buttons() { | |
| if ( edd_is_free_download( get_the_ID() ) ) { | |
| return; | |
| } | |
| $edd_social_discounts = edd_social_discounts(); | |
| $display = edd_get_option( 'edd_sd_display_services', 'after' ); | |
| // don't automatically output the sharing services | |
| if ( 'none' != $display ) { | |
| // load sharing box by default after download content | |
| if ( 'after' == $display ) { | |
| add_action( 'edd_after_download_content', array( $edd_social_discounts, 'load_share_box' ) ); | |
| } | |
| // load before content | |
| elseif ( 'before' == $display ) { | |
| add_action( 'edd_before_download_content', array( $edd_social_discounts, 'load_share_box' ) ); | |
| } | |
| } | |
| } | |
| $edd_social_discounts = edd_social_discounts(); | |
| // remove plugin's display_share_buttons() function | |
| remove_action( 'template_redirect', array( $edd_social_discounts, 'display_share_buttons' ) ); | |
| // add our new function | |
| add_action( 'template_redirect', 'sumobi_edd_social_discount_display_share_buttons' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment