Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1059183

    socialup
    Participant

    Ah wait, we found the instagram camp in the profile now! It just isn’t showing in the author box πŸ™ Tried both using just the username and the full link (http://instagram.com/username)

    #1059194

    socialup
    Participant

    SORRY again, thanks so much. The .php file wasn’t saving but now it works perfectly! <3 You guys are the best.

    #1059206

    Christopher
    Moderator

    Glad to hear that we were able to help you with this.

    #1059286

    socialup
    Participant

    I’m so sorry to have to bug you guys again with this!

    1. It was just pointed out to me that although it shows the instagram link, the facebook icon is used πŸ™ (attached photo)
    2. By any chance can we also add LinkedIn? On top of this code in the functions.php:

    // Register User Contact Methods
    function custom_user_contact_methods( $user_contact_method ) {
    
    	$user_contact_method['linkedin'] = __( '', 'text_domain' );
    
    	return $user_contact_method;
    
    }
    add_filter( 'user_contactmethods', 'custom_user_contact_methods' );

    What would we need to add to have the LinkedIn URL (and proper icon) show in the Author Box?

    #1059484

    Rad
    Moderator

    Hi there,

    Please update your code to this,

    function x_shortcode_author_v2( $atts ) {
      extract( shortcode_atts( array(
        'id'        => '',
        'class'     => '',
        'style'     => '',
        'title'     => '',
        'author_id' => ''
      ), $atts, 'x_author' ) );
    
      $id        = ( $id        != '' ) ? 'id="' . esc_attr( $id ) . '"' : '';
      $class     = ( $class     != '' ) ? 'x-author-box cf ' . esc_attr( $class ) : 'x-author-box cf';
      $style     = ( $style     != '' ) ? 'style="' . $style . '"' : '';
      $title     = ( $title     != '' ) ? $title : __( 'About the Author', csl18n() );
      $author_id = ( $author_id != '' ) ? $author_id : get_the_author_meta( 'ID' );
    
      $description  = get_the_author_meta( 'description', $author_id );
      $display_name = get_the_author_meta( 'display_name', $author_id );
      $facebook     = get_the_author_meta( 'facebook', $author_id );
      $twitter      = get_the_author_meta( 'twitter', $author_id );
      $googleplus   = get_the_author_meta( 'googleplus', $author_id );
      $instagram    = get_the_author_meta( 'instagram', $author_id );
      $linkedin     = get_the_author_meta( 'linkedin', $author_id );
      $author_url   = get_author_posts_url( $author_id );
    
      $facebook_output   = ( $facebook )   ? "<a href=\"{$facebook}\" class=\"x-author-social\" title=\"Visit the Facebook Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-facebook-square\" data-x-icon=\"ο‚‚\"></i> Facebook</a>" : '';
      $twitter_output    = ( $twitter )    ? "<a href=\"{$twitter}\" class=\"x-author-social\" title=\"Visit the Twitter Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-twitter-square\" data-x-icon=\"\"></i> Twitter</a>" : '';
      $googleplus_output = ( $googleplus ) ? "<a href=\"{$googleplus}\" class=\"x-author-social\" title=\"Visit the Google+ Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-google-plus-square\" data-x-icon=\"\"></i> Google+</a>" : '';
      $instagram_output   = ( $instagram )   ? "<a href=\"{$instagram}\" class=\"x-author-social\" title=\"Visit the Instagram Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-instagram-square\" data-x-icon=\"\"></i> Instagram</a>" : '';
    
      $linkedin_output   = ( $linkedin )   ? "<a href=\"{$linkedin}\" class=\"x-author-social\" title=\"Visit the Instagram Profile for {$display_name}\" target=\"_blank\"><i class=\"x-icon-linkedin-square\" data-x-icon=\"\"></i> LinkedIn</a>" : '';
    
      $output = "<div {$id} class=\"{$class}\" {$style}>"
                . "<h6 class=\"h-about-the-author\">{$title}</h6>"
                . get_avatar( $author_id, 180 )
                . '<div class="x-author-info">'
                  . "<h4 class=\"h-author mtn\"><a href=\"{$author_url}\">{$display_name}</a></h4>"
                    . $facebook_output
                    . $twitter_output
                    . $googleplus_output
                    . $instagram_output
                    . $linkedin_output
                  . "<p class=\"p-author mbn\">{$description}</p>"
                . '</div>'
              . '</div>';
    
      return $output;
    }
    
    function change_author_shortcode_to_v2() {
      remove_shortcode( 'x_author' );
      remove_shortcode( 'author' );
      add_shortcode( 'x_author', 'x_shortcode_author_v2' );
      add_shortcode( 'author', 'x_shortcode_author_v2' );
    }
    add_action('init', 'change_author_shortcode_to_v2');
    
    function add_profile_instagram ( $profile_fields ) {
    
      $profile_fields['instagram'] = 'Instagram Profile';
      $profile_fields['linkedin'] = 'LinkedIn Profile';
    
      return $profile_fields;
    }
    
    add_filter('user_contactmethods', 'add_profile_instagram');

    Hope this helps.

    #1059556

    socialup
    Participant

    Perfect! Thanks so much!

    #1059762

    Rue Nel
    Moderator

    You’re welcome!
    We’re glad we were able to help you out.