Skip to content

Instantly share code, notes, and snippets.

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 cameronjonesweb/4141cc0eba91094206631ea50a8cebf4 to your computer and use it in GitHub Desktop.
Save cameronjonesweb/4141cc0eba91094206631ea50a8cebf4 to your computer and use it in GitHub Desktop.
<?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