Home Forums WoodMart support forum Single Author page show social media

Single Author page show social media

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #527525

    696.kishanmakwana
    Participant

    Single Author page how to show social media icons i have add social media but not show in author page.
    Link:- https://goedmedicine.com/author/florencio-lee/

    #527970

    Hung Pham
    Keymaster

    Hi 696.kishanmakwana,

    Thanks for reaching to us and I am appreciate your patience.

    Unfortunately, there is no such option in our theme by default.

    Regards,

    #528243

    696.kishanmakwana
    Participant

    any solutions show we have add show all social media in author page
    https://goedmedicine.com/author/florencio-lee/

    #528582

    Hung Pham
    Keymaster

    Hi 696.kishanmakwana,

    As I replied earlier.

    Unfortunately, there is no such option in our theme by default.

    Regards,

    #534078

    696.kishanmakwana
    Participant

    i have fixed this issue using custome code.
    Link: https://goedmedicine.com/author/florencio-lee/
    Code:

    // Add Custom Social media icon (Instagram, Facebook, Twitter, and Email)
    function woodmart_author_social_media_links() {
        $author_id = get_the_author_meta('ID');
    
        // Social media keys with corresponding Font Awesome icons
        $social_media_keys = array(
            'twitter'   => 'fab fa-twitter',
            'facebook'  => 'fab fa-facebook-f',
            'instagram' => 'fab fa-instagram',
            'gmail'     => 'fas fa-envelope', // Use a general email icon for Gmail
            // Add more social media keys as needed
        );
    
        echo '<div class="author-social-media">';
    
        foreach ($social_media_keys as $social_media_key => $icon_class) {
            $social_media_url = '';
    
            if ($social_media_key === 'gmail') {
                // Get the current user's email
                $current_user_email = get_the_author_meta('user_email', $author_id);
                $social_media_url = 'mailto:' . esc_attr($current_user_email);
            } elseif (in_array($social_media_key, array('facebook', 'twitter'))) {
                // For Facebook and Twitter, assume the user profile fields have the corresponding URLs
                $social_media_url = get_the_author_meta($social_media_key, $author_id);
            } elseif ($social_media_key === 'instagram') {
                // For Instagram, assume the user profile field has the corresponding URL
                $social_media_url = get_the_author_meta('instagram_url', $author_id);
            }
    
            if (!empty($social_media_url)) {
                echo '<a href="' . esc_url($social_media_url) . '" target="_blank" rel="nofollow">';
                echo '<i class="' . esc_attr($icon_class) . '" aria-hidden="true"></i>';
                echo '</a>';
            }
        }
    
        echo '</div>';
    }
    
    // Add the social media links to the author bio
    add_action('woodmart_author_social_media', 'woodmart_author_social_media_links');

    Close ticket

    #534229

    Hung Pham
    Keymaster

    Hi 696.kishanmakwana,

    Glad to hear your issue has been resolved. Keep us in mind for future questions and concerns, we’re always here to help!

    Regards,

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Single Author page show social media’ is closed to new replies.