Skip to content

Instantly share code, notes, and snippets.

@kisildev
Created June 25, 2019 15:25
Show Gist options
  • Save kisildev/27c0e3260011a2287f49eeab02cbec8f to your computer and use it in GitHub Desktop.
Save kisildev/27c0e3260011a2287f49eeab02cbec8f to your computer and use it in GitHub Desktop.
WP user metadata. User data/
<section class="user-section">
<div class="container">
<div class="row">
<div class="col-md-4 col-lg-push-8">
<?php if($user_avatar = get_field('user_avatar', 'user_'.$user_id)): ?>
<div class="user-section__img-wrap">
<div class="user-section__img" <?php bg($user_avatar, null, 'medium'); ?>></div>
</div>
<?php endif; ?>
</div>
<div class="col-md-8 col-lg-pull-4">
<div class="user-section__content">
<?php if ($user_title = get_field('user_title', 'user_'.$user_id)): ?>
<h1 class="h1 user-section__title"><?php echo $user_title; ?></h1>
<?php endif; ?>
<?php if ($metadesc = get_the_author_meta('description')): ?>
<div class="user-section__descr"><?php echo $metadesc; ?></div>
<?php endif; ?>
<div class="user-contact-info">
<?php
$user_data = [
'Website' => $website = get_the_author_meta('url'),
'Facebook' => $facebook = get_the_author_meta('facebook'),
'Instagram' => $instagram = get_the_author_meta('instagram'),
'LinkedIn' => $linkedin = get_the_author_meta('linkedin'),
'MySpace' => $myspace = get_the_author_meta('myspace'),
'Pinterest' => $pinterest = get_the_author_meta('pinterest'),
'SoundCloud' => $soundcloud = get_the_author_meta('soundcloud'),
'Tumbrl' => $tumblr = get_the_author_meta('tumblr'),
'Twitter' => $twitter = get_the_author_meta('twitter'),
'YouTybe' => $youtube = get_the_author_meta('youtube'),
'Wikipedia' => $wikipedia = get_the_author_meta('wikipedia'),
];
?>
<?php foreach ($user_data as $name => $value): ?>
<?php if(!$value) { continue; } ?>
<div class="user-contact-info__item">
<span class="user-contact-info__name"><?php echo $name; ?>:</span>
<a href="<?php echo $name == 'Twitter' ? 'https://twitter.com/' : null; ?><?php echo $value; ?>" class="user-contact-info__link" target="_blank"><?php echo $value; ?></a>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment