Forked from ipokkel/pmpro-member-directory-clickable-usr-url.php
Last active
August 24, 2022 12:57
-
-
Save kimwhite/8d18b9a34ba8047d0fab4f162217b333 to your computer and use it in GitHub Desktop.
Display the user_url field as a clickable URL link on the PMPro Member Directory and Profile pages if the field was included in the shortcode's field attributes.
This file contains hidden or 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 a clickable URL for the user_url profile field, with the word WEBSITE | |
* This will also stop the URL from being embedded with wp_oembed. | |
* | |
* 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 my_pmpromd_clickable_user_url( $value, $original_value, $field_name ) { | |
if ( 'user_url' === $field_name ) { | |
$value = ('<a href="'. $original_value . '" target="_blank">Website</a>' ); | |
} | |
return $value; | |
} | |
add_filter( 'pmpromd_format_profile_field', 'my_pmpromd_clickable_user_url', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment