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 rickalday/eb988fbb9fb65e7ba055d65f3fd09592 to your computer and use it in GitHub Desktop.
Save rickalday/eb988fbb9fb65e7ba055d65f3fd09592 to your computer and use it in GitHub Desktop.
GiveWP donation confirmation, donation history, and failed donation pages based on language - Polylang version
function give_get_success_page_uri_with_language() {
$give_options = give_get_settings();
$page_id = $give_options['success_page'];
if (function_exists('pll_get_post')):
$page_id = pll_get_post($page_id);
endif;
$success_page = isset( $page_id ) ? get_permalink( absint( $page_id ) ) : get_bloginfo( 'url' );
return $success_page;
}
add_filter('give_get_success_page_uri', 'give_get_success_page_uri_with_language', 10, 1);
function give_get_failed_page_uri_with_language() {
$give_options = give_get_settings();
$page_id = $give_options['failure_page'];
if (function_exists('pll_get_post')):
$page_id = pll_get_post($page_id);
endif;
$success_page = isset( $page_id ) ? get_permalink( absint( $page_id ) ) : get_bloginfo( 'url' );
return $success_page;
}
add_filter('give_get_failed_transaction_uri', 'give_get_failed_page_uri_with_language', 10, 1);
function give_get_donation_history_page_uri_with_language() {
$give_options = give_get_settings();
$page_id = $give_options['history_page'];
if (function_exists('pll_get_post')):
$page_id = pll_get_post($page_id);
endif;
$success_page = isset( $page_id ) ? get_permalink( absint( $page_id ) ) : get_bloginfo( 'url' );
return $success_page;
}
add_filter('give_get_history_page_uri', 'give_get_donation_history_page_uri_with_language', 10, 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment