Last active
April 12, 2021 22:30
-
-
Save strangerstudios/8958d7d85f873abe063396445b0e7d6a to your computer and use it in GitHub Desktop.
Show the Member Badge for each level on the table layout Membership Levels page
This file contains 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 | |
/* | |
Sample method to show a level's Member Badge on the table layout of the | |
Membership Levels page when using the Advanced Levels Page Shortcode Add On. | |
*/ | |
function my_pmproal_extra_cols_before_header( ) { | |
echo '<th>Badge</th>'; | |
} | |
add_action( 'pmproal_extra_cols_before_header', 'my_pmproal_extra_cols_before_header'); | |
function my_pmproal_extra_cols_before_body( $level_id ) { | |
if( function_exists( 'pmpromb_getBadgeForLevel' ) ) { | |
$image = pmpromb_getBadgeForLevel($level_id); | |
if( ! empty( $image ) ) { | |
echo '<td><img style="width: 75px;" class="pmpro_member_badge" src="' . esc_url($image) . '" border="0" /></td>'; | |
} | |
} | |
} | |
add_action( 'pmproal_extra_cols_before_body', 'my_pmproal_extra_cols_before_body'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/