Created
July 3, 2020 12:24
-
-
Save JarrydLong/17c0d2ea1005def7ff57b62d2e110e17 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* This recipe will display custom content in the marker info window. Members will need | |
* a membership level of 1 or 2 in order for this to be displayed. | |
* | |
* 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 mypmpromm_single_marker_content_protected( $content, $member ){ | |
if( pmpro_hasMembershipLevel( 1, 2 ) ){ //Change levels to your preference | |
$graduation_year = get_user_meta( $member['ID'], 'graduation_year', true ); | |
$content .= "<p><strong>Graduation Year</strong> ".$graduation_year."</p>"; | |
} | |
return $content; | |
} | |
add_filter( 'pmpromm_single_marker_content', 'mypmpromm_single_marker_content_protected', 10, 2 ); |
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 "Adding Custom Content To Your Marker Info Window" at Paid Memberships Pro here: https://www.paidmembershipspro.com/adding-custom-content-to-your-marker-info-window/