Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JarrydLong/17c0d2ea1005def7ff57b62d2e110e17 to your computer and use it in GitHub Desktop.
Save JarrydLong/17c0d2ea1005def7ff57b62d2e110e17 to your computer and use it in GitHub Desktop.
<?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 );
@laurenhagan0306
Copy link

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/

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