learndash_payment_button

apply_filters( 'learndash_payment_button',  string $payment_button,  array $payment_params )

Filters PayPal payment button markup.


Description #


Parameters #

$payment_button

(string) Payment button markup.

$payment_params

(array) An array of payment paramter details.


Source #

File: includes/ld-misc-functions.php


Examples #

 <?php
/**
 * Example usage for learndash_payment_button filter.
 */
add_filter( 'learndash_payment_button', 'theme_learndash_payment_button', 10, 2 );
function theme_learndash_payment_button( $join_button, $payment_params ) {
	$join_button_new = '';

	$join_button_parts = explode( '<', $join_button );
	if ( ! empty( $join_button_parts ) ) {
		foreach ( $join_button_parts as $idx => $join_button_part ) {
			if ( ( strncasecmp( $join_button_part, 'input', strlen( 'input' ) ) == 0 ) && ( strstr( $join_button_part, ' type="submit" ' ) !== false ) ) {

				$join_button_part_new = $join_button_part;

				$join_button_part = str_replace( 'type="submit"', 'type="hidden"', $join_button_part );
				$join_button_part = str_replace( 'id="btn-join"', '', $join_button_part );
				$join_button_part = str_replace( 'class="btn-join"', '', $join_button_part );

				$join_button_part_new = str_replace( 'name="course_join"', '', $join_button_part_new );

				$join_button_parts[ $idx ] = $join_button_part . '<' . $join_button_part_new;
			}
		}

		$join_button = implode( '<', $join_button_parts );
	}

	return $join_button;
}
 

Changelog #

Changelog
Version Description
2.1.0 Introduced.