Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save strangerstudios/6971fc87b780bfdd13724c27f97df796 to your computer and use it in GitHub Desktop.
Save strangerstudios/6971fc87b780bfdd13724c27f97df796 to your computer and use it in GitHub Desktop.
Show the Member Badge for each level on the 3 column layout Membership Levels page
<?php
/*
Sample method to show a level's Member Badge on the three column layout of the
Membership Levels page when using the Advanced Levels Page Shortcode Add On.
*/
function my_pmproal_before_level_member_badge( $level_id, $layout ) {
if( function_exists( 'pmpromb_getBadgeForLevel' ) ) {
$image = pmpromb_getBadgeForLevel($level_id);
if( ! empty( $image ) && $layout == '3col' ) {
echo '<img class="pmpro_member_badge" src="' . esc_url($image) . '" border="0" />';
}
}
}
add_action( 'pmproal_before_level', 'my_pmproal_before_level_member_badge', 10, 2);
@laurenhagan0306
Copy link

This recipe is included in the blog post on "Enhance Your Membership Levels Page with Member Badges" at Paid Memberships Pro here: https://www.paidmembershipspro.com/enhance-membership-levels-page-member-badges/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment