Created
August 25, 2017 19:00
-
-
Save SeanTOSCD/3cdca76d1323692f06c682d9ec6b5763 to your computer and use it in GitHub Desktop.
EDD External Products open in new tab
This file contains 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 // DO NOT COPY THIS LINE | |
function sd_edd_external_products_product_links( $purchase_form, $args ) { | |
if( $url = get_post_meta( $args['download_id'], '_edd_external_product_url', true ) ) { | |
$label = get_post_meta( $args['download_id'], '_edd_external_product_button', true ); | |
$purchase_form = '<div class="edd_download_purchase_form">'; | |
$purchase_form .= '<div class="edd_purchase_submit_wrapper">'; | |
$purchase_form .= sprintf( | |
'<a class="%1$s" href="%2$s" target="_blank">%3$s</a>', | |
implode( ' ', array( $args['style'], $args['color'], trim( $args['class'] ) ) ), | |
esc_url( $url ), | |
esc_attr( $label ) | |
); | |
$purchase_form .= '</div>'; | |
$purchase_form .= '</div>'; | |
} | |
return $purchase_form; | |
} | |
remove_action( 'edd_purchase_download_form', 'edd_external_products_product_links', 10, 2 ); | |
add_action( 'edd_purchase_download_form', 'sd_edd_external_products_product_links', 100, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment