<?php 
/**
 * @package WordPress
 * @subpackage Campoal
 */

$author_id = get_the_author_meta('ID');
$author_name = get_the_author();
$author_address = get_the_author_meta('user_address');
$author_country = get_the_author_meta('user_country');
$author_city = get_the_author_meta('user_city');
$author_state = get_the_author_meta('user_state');
$author_neighborhood = get_the_author_meta('user_neightborhood');
$author_description = get_the_author_meta('description');
$author_post_count = count_user_posts($author_id);

$author_avatar          = conikal_get_avatar_url( $author_id, array('size' => 128) );
$author_avatar_retina   = conikal_get_avatar_url( $author_id, array('size' => 256) );

$followers = get_user_meta($author_id, 'following_user', true);
$followers_num = $followers ? count($followers) : 0;

$lazy_placeholder_avatar = conikal_lazy_load_placeholder('avatar');
?>

<div class="post-author-section">
    <div class="ui padded secondary segment">
        <div class="ui header">
            <img class="ui circular image lazy" data-src="<?php echo esc_url($author_avatar); ?>" data-retina="<?php echo esc_url($author_avatar_retina); ?>" src="<?php echo esc_url($lazy_placeholder_avatar); ?>" alt="<?php echo esc_attr($author_name); ?>">
            <div class="content">
                <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' )); ?>" data-bjax>
                    <?php echo esc_html($author_name); ?>
                </a>
                <div class="sub header font small text grey">
                    <?php echo esc_html( $followers_num > 0 ? sprintf(_n('%s follower', '%s followers', $followers_num, 'campoal'), conikal_format_number('%!.0i', $followers_num, true)) . ' · ' : '') ?>
                    <?php echo esc_html( $author_post_count > 0 ? sprintf(_n('%s post', '%s posts', $author_post_count, 'campoal'), conikal_format_number('%!.0i', $author_post_count, true)) : '') ?>
                    <?php // echo esc_html($author_description) ?>
                </div>
            </div>
        </div>
    </div>
</div>