Created
June 20, 2024 16:17
-
-
Save ipokkel/7ae16733c1e7d6acf6cef4d4ed7137e6 to your computer and use it in GitHub Desktop.
Add CSS to only show member Member Links on the PMPro Account page for affiliates.
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 | |
/** | |
* Show member links on the account page only to affiliates. | |
* | |
* 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 pmpro_show_member_links_for_affiliates_only() { | |
// bail if pmpro_affiliates_getAffiliatesForUser() is not available | |
if ( ! function_exists( 'pmpro_affiliates_getAffiliatesForUser' ) ) { | |
return; | |
} | |
$affiliates = pmpro_affiliates_getAffiliatesForUser( get_current_user_id() ); | |
if ( empty( $affiliates ) ) { | |
?> | |
<style> | |
#pmpro_account-links { | |
display: none; | |
} | |
</style> | |
<?php | |
} | |
} | |
add_action( 'wp_head', 'pmpro_show_member_links_for_affiliates_only' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment