Skip to content

Instantly share code, notes, and snippets.

@SeanTOSCD
Created August 25, 2017 19:00
Show Gist options
  • Save SeanTOSCD/3cdca76d1323692f06c682d9ec6b5763 to your computer and use it in GitHub Desktop.
Save SeanTOSCD/3cdca76d1323692f06c682d9ec6b5763 to your computer and use it in GitHub Desktop.
EDD External Products open in new tab
<?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