redmi87
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
thanks it works
I am using this but the image is not displayed can you help me
function um_user_img_shortcode($atts) { if (!class_exists('UM') || !is_user_logged_in()) { return ''; } $atts = shortcode_atts(array( 'user_id' => get_current_user_id(), 'meta_key' => '', ), $atts); if (empty($atts['meta_key'])) { return ''; } $user_id = absint($atts['user_id']); $meta_key = sanitize_key($atts['meta_key']); $image_name = get_user_meta($user_id, $meta_key, true); if (empty($image_name)) { return ''; } $uploads_dir = wp_upload_dir(); $image_url = $uploads_dir['baseurl'] . '/' . $image_name; if (empty($image_url)) { return ''; } $output = '<img src="' . esc_url($image_url) . '" alt="Imagen" />'; return $output; } add_shortcode('um_user_img', 'um_user_img_shortcode');https://www.screencast.com/t/oPh23aflM
- This reply was modified 5 years, 4 months ago by redmi87.
Viewing 4 replies - 1 through 4 (of 4 total)