[NSFW] creating a shortcode for cover photo
-
I’m trying to create a shortcode that fetch the user’s cover photo but i don’t know why it isn’t working. I’m using this code now:
add_shortcode('link_cover_perfil', 'generate_cover_link'); function generate_cover_link() { // Check if Ultimate Member plugin is active if (function_exists('um_user')) { // Get the current user's ID $user_id = um_user('ID'); um_fetch_user($user_id); // Get the avatar URL for the user $cover_url = get_user_meta( $user_id, 'cover_photo', true ); // Check if avatar URL is found if (!empty($cover_url)) { // Return the img tag with avatar URL $res = "<img src=\"{$avatar_url}\" style=\"width: 100%; height:400px;\"/>"; return $res; } else { return "URL da imagem de capa de perfil n?o encontrada para o usuário atual."; } } else { return "Ultimate Member plugin n?o está instalado ou ativado."; } }
My final goal is to show this cover as a div background image and the user’s name in front of it.
PS:. mature content page (NSFW)
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘[NSFW] creating a shortcode for cover photo’ is closed to new replies.