Created
March 19, 2019 12:19
-
-
Save gianghl1983/79eae6056fb2ba62f86d89e72e23e4c2 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
add_action("init","um_custom_init"); | |
function um_custom_init(){ | |
remove_action('wp_head', 'um_profile_dynamic_meta_desc', 9999999); | |
} | |
add_action('wp_head', 'um_custom_profile_dynamic_meta_desc', 9999999); | |
function um_custom_profile_dynamic_meta_desc() { | |
global $ultimatemember; | |
if ( um_is_core_page('user') && um_get_requested_user() ) { | |
um_fetch_user( um_get_requested_user() ); | |
$content = um_convert_tags( um_get_option('profile_desc') ); | |
$user_id = um_user('ID'); | |
$url = um_user_profile_url(); | |
if ( um_profile('cover_photo') ) { | |
$cover_uri = um_get_cover_uri( um_profile('cover_photo'), null ); | |
} else if( um_profile('synced_cover_photo') ) { | |
$cover_uri = um_profile('synced_cover_photo'); | |
}else{ | |
$cover_uri = um_get_default_cover_uri(); | |
} | |
um_reset_user(); ?> | |
<meta name="description" content="<?php echo $content; ?>"> | |
<meta property="og:title" content="<?php echo um_get_display_name( $user_id ); ?>" /> | |
<meta property="og:type" content="article" /> | |
<meta property="og:image" content="<?php echo $cover_uri; ?>" /> | |
<meta property="og:url" content="<?php echo $url; ?>" /> | |
<meta property="og:description" content="<?php echo $content; ?>" /> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment