<?php
$author_id = esc_attr(get_the_author_meta('ID'));
$social_networks   = onschedule_edge_core_plugin_installed() ? onschedule_edge_get_user_custom_fields() : false;
?>
<?php if(get_the_author_meta('description') !== "") { ?>
	<div class="edgtf-author-description">
		<div class="edgtf-author-description-inner">
			<div class="edgtf-author-description-image">
				<a itemprop="url" href="<?php echo esc_url(get_author_posts_url($author_id)); ?>" title="<?php the_title_attribute(); ?>" target="_self">
					<?php echo onschedule_edge_kses_img(get_avatar(get_the_author_meta( 'ID' ), 142)); ?>
				</a>
			</div>
			<div class="edgtf-author-description-text-holder">
				<h6 class="edgtf-author-name vcard author">
					<a itemprop="url" href="<?php echo esc_url(get_author_posts_url($author_id)); ?>" title="<?php the_title_attribute(); ?>" target="_self">
						<span class="fn">
							<span class="edgtf-author-name-label"><?php esc_html_e('Written by:', 'onschedule'); ?></span>
							<?php
							if(get_the_author_meta('first_name') != "" || get_the_author_meta('last_name') != "") {
								echo esc_attr(get_the_author_meta('first_name')) . " " . esc_attr(get_the_author_meta('last_name'));
							} else {
								echo esc_attr(get_the_author_meta('display_name'));
							}
							?>
						</span>
					</a>
				</h6>
				<?php if(is_email(get_the_author_meta('email'))){ ?>
					<p itemprop="email" class="edgtf-author-email"><?php echo sanitize_email(get_the_author_meta('email')); ?></p>
				<?php } ?>
				<?php if(get_the_author_meta('description') != "") { ?>
					<div class="edgtf-author-text">
						<p itemprop="description"><?php echo esc_attr(get_the_author_meta('description')); ?></p>
					</div>
				<?php } ?>
				<?php if(is_array($social_networks) && count($social_networks)){ ?>
					<div class="edgtf-author-social-icons clearfix">
						<?php foreach($social_networks as $network){ ?>
							<a itemprop="url" href="<?php echo esc_attr($network['link'])?>" target="_blank">
								<?php echo onschedule_edge_icon_collections()->renderIcon($network['class'], 'font_elegant'); ?>
							</a>
						<?php }?>
					</div>
				<?php } ?>
			</div>
		</div>
	</div>
<?php } ?>