Skip to content

Instantly share code, notes, and snippets.

@dwanjuki
Created February 5, 2026 13:19
Show Gist options
  • Select an option

  • Save dwanjuki/a3ff130d02a6c2f1b0edc58adb207081 to your computer and use it in GitHub Desktop.

Select an option

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.
<?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