Created
February 5, 2026 13:19
-
-
Save dwanjuki/a3ff130d02a6c2f1b0edc58adb207081 to your computer and use it in GitHub Desktop.
Move PMPro Membership Card QR COde to the bottom right of the card.
This file contains hidden or 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 | |
| /** | |
| * Move PMPro Membership Card QR COde to the bottom right of the card. | |
| * | |
| * You can add this recipe to your site by creating a custom plugin | |
| * or using the Code Snippets plugin available for free in the WordPress repository. | |
| * Read this companion article for step-by-step directions on either method. | |
| * https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmpro_membership_card_left_remove_qr( $card_content_left, $pmpro_membership_card_user, $atts ) { | |
| // Remove the QR code if enabled. | |
| if ( $atts['qr_code'] ) { | |
| unset( $card_content_left['qr_code'] ); | |
| } | |
| return $card_content_left; | |
| } | |
| add_filter( 'pmpro_membership_card_left', 'my_pmpro_membership_card_left_remove_qr', 10, 3 ); | |
| function my_pmpro_membership_card_right_add_qr( $card_content_right, $pmpro_membership_card_user, $atts ) { | |
| // Show the QR code if enabled. | |
| if ( $atts['qr_code'] ) { | |
| $qr_code_data = pmpro_membership_card_return_qr_code_data( $pmpro_membership_card_user, $atts['qr_data'] ); | |
| if ( ! empty( $qr_code_data ) ) { | |
| $card_content_right['qr_code'] = '<img style="float:right" src="' . esc_url( $qr_code_data ) . '" />'; | |
| } | |
| } | |
| return $card_content_right; | |
| } | |
| add_filter( 'pmpro_membership_card_right', 'my_pmpro_membership_card_right_add_qr', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment