Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save NateJLewis/d3becba14edcd906ea916b2433c3a1be to your computer and use it in GitHub Desktop.

Select an option

Save NateJLewis/d3becba14edcd906ea916b2433c3a1be to your computer and use it in GitHub Desktop.
<section id="author-box" class="col-xs-12 col-md-6">
<?php
$site_url = site_url();
$img_icon_dir = get_template_directory_uri() . '/assets/images/icons/';
$facebook_icon = $img_icon_dir . 'facebook_white_bg.png';
$twitter_icon = $img_icon_dir . 'twitter_white_bg.png';
$youtube_icon = $img_icon_dir . 'youtube_white_bg.png';
$instagram_icon = $img_icon_dir . 'instagram_white_bg.png';
$googleplus_icon = $img_icon_dir . 'google_plus_white_bg.png';
$pinterest_icon = $img_icon_dir . 'pinterest_white_bg.png';
// $website_icon = $img_icon_dir . 'website_white_bg.png';
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
$user_meta = get_user_meta( $user_id );
$user_meta = array_map( function( $a ) {
return $a[0];
}, $user_meta );
$nickname = $user_meta['nickname'];
$first_name = $user_meta['first_name'];
$last_name = $user_meta['last_name'];
$description = $user_meta['description'];
$website_url = $user_meta['website'];
// avatar
$avatar_file = get_post_meta( $user_meta['avatar_url'], '_wp_attached_file' );
$avatar_url = $site_url . '/wp-content/uploads/' . $avatar_file[0];
// instagram
$instagram_username = $user_meta['instagram_username'];
$instagram_url = 'https://www.instagram.com/' . $instagram_username;
// pinterest
$pinterest_username = $user_meta['pinterest_username'];
$pinterest_url = 'https://www.pinterest.com/' . $pinterest_username;
// googleplus
$googleplus_username = $user_meta['googleplus_username'];
$googleplus_url = 'https://plus.google.com/u/0/' . $googleplus_username;
// twitter
$twitter_username = $user_meta['twitter_username'];
$twitter_url = 'https://twitter.com/' . $twitter_username;
// facebook
$facebook_username = $user_meta['facebook_username'];
$facebook_url = 'https://www.facebook.com/' . $facebook_username;
// youtube
$youtube_username = $user_meta['youtube_username'];
$youtube_url = 'https://www.youtube.com/channel/' . $youtube_username;
?>
<div class="card-deck author_box_deck">
<div class="card">
<img class="card-img" src="<?php echo esc_url( $avatar_url ) ?>" alt="" height="120" width="120" />
</div>
<div class="card">
<div class="card-header">
<h4 class="card-title display-4 author_name"><?php echo esc_html( $first_name ) ?>&nbsp;<?php echo esc_html( $last_name ) ?></h4>
</div>
<div class="card-block about_block">
<strong class="about_what">Nickname: </strong><h6 class="card-title about_content"><?php echo esc_html( $nickname ) ?></h6>
<strong class="about_what">Biography: </strong><p class="card-text about_content"><?php _e( $description, '_fkns' ); ?></p>
<strong class="about_what">Website: </strong><a class="card-link about_content" href="<?php echo esc_url( $website_url ) ?>" target="_blank" rel="nofollow"><?php _e( 'Website', '_fkns' ); ?></a>
</div>
<div class="card-footer">
<a class="card-link author_social user_social" href="<?php echo esc_url( $instagram_url ) ?>" target="_blank" rel="nofollow">
<img class="img-fluid" src="<?php echo esc_url( $instagram_icon ) ?>" alt="<?php echo esc_attr( $instagram_username ) ?> on Instagram">
</a>
<a class="card-link author_social user_social" href="<?php echo esc_url( $pinterest_url ) ?>" target="_blank" rel="nofollow">
<img class="img-fluid" src="<?php echo esc_url( $pinterest_icon ) ?>" alt="<?php echo esc_attr( $pinterest_username ) ?> on Pinterest">
</a>
<a class="card-link author_social user_social" href="<?php echo esc_url( $googleplus_url ) ?>" target="_blank" rel="nofollow">
<img class="img-fluid" src="<?php echo esc_url( $googleplus_icon ) ?>" alt="<?php echo esc_attr( $googleplus_username ) ?> on Google+">
</a>
<a class="card-link author_social user_social" href="<?php echo esc_url( $twitter_url ) ?>" target="_blank" rel="nofollow">
<img class="img-fluid" src="<?php echo esc_url( $twitter_icon ) ?>" alt="<?php echo esc_attr( $twitter_username ) ?> on Twitter">
</a>
<a class="card-link author_social user_social" href="<?php echo esc_url( $facebook_url ) ?>" target="_blank" rel="nofollow">
<img class="img-fluid" src="<?php echo esc_url( $facebook_icon ) ?>" alt="<?php echo esc_attr( $facebook_username ) ?> on Facebook">
</a>
<a class="card-link author_social user_social" href="<?php echo esc_url( $youtube_url ) ?>" target="_blank" rel="nofollow">
<img class="img-fluid" src="<?php echo esc_url( $youtube_icon ) ?>" alt="<?php echo esc_attr( $youtube_username ) ?> on YouTube">
</a>
</div>
</div>
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment