Skip to content

Instantly share code, notes, and snippets.

@bekarice
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bekarice/3401fdc63255cbfdcd72 to your computer and use it in GitHub Desktop.
Save bekarice/3401fdc63255cbfdcd72 to your computer and use it in GitHub Desktop.
Adds JP sharing buttons before EDD download pricing / purchase button
/**
* Adds sharing buttons before pricing options (variable) or purchase button (simple)
* Tutorial: http://www.sellwithwp.com/add-social-sharing-buttons-to-easy-digital-downloads/
**/
function add_edd_share_buttons() {
global $post;
if ( is_singular( 'download' ) && function_exists( 'sharing_display' ) ) {
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
function add_sharing_buttons() {
echo sharing_display();
}
if ( edd_has_variable_prices( $post->ID ) ) {
add_action( 'edd_before_price_options', 'add_sharing_buttons' );
} else {
add_action( 'edd_purchase_link_top', 'add_sharing_buttons' );
}
}
}
add_action( 'wp', 'add_edd_share_buttons' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment