Last active
August 15, 2018 14:10
-
-
Save cameronjonesweb/4141cc0eba91094206631ea50a8cebf4 to your computer and use it in GitHub Desktop.
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 | |
add_action( 'pricing_tables_for_edd_footer_end', 'cameronjonesweb_free_downloads_link_to_modal', 9 ); | |
/** | |
* Changes the pricing tables link to use the modal if it's a free download | |
* | |
* @param array $args User defined data for the pricing table. | |
*/ | |
function cameronjonesweb_free_downloads_link_to_modal( $args ) { | |
if ( class_exists( 'EDD_Free_Downloads' ) ) { | |
if ( edd_free_downloads_use_modal( get_the_ID() ) ) { | |
remove_action( 'pricing_tables_for_edd_footer_end', [ PTF_Pricing_Tables_For_EDD::get_instance()->frontend, 'purchase_button' ] ); | |
$button_text = ! empty( $args['button_text'] ) ? $args['button_text'] : __( 'Purchase' ); | |
printf( | |
'<a class="edd-pt-button button edd-free-download" href="#edd-free-download-modal">%1$s</a>', | |
esc_html( apply_filters( 'pricing_tables_for_edd_complete_purchase_text', $button_text ) ) | |
); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment