Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.