<?php 
get_header();
$auth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
$bg = get_user_meta($auth->ID, '_cover', true);
if($bg == '') {
    $bg = get_template_directory_uri() . '/img/user-cover.jpg';
}
$kudos = teo_get_kudos($auth->ID);
?>
<section id="main" role="main">
    <div class="container">
        <div class="row">
            <div class="col-sm-9 right-content profile-bg">
                <?php if($redux_demo['ad1'] != '') {
                    echo '<div class="header_ad">' . $redux_demo['ad1'] . '</div>';
                } ?>
                <div class="row">
                    <div class="profile-wrap" style="background-image: url('<?php echo esc_url($bg);?>')">
                        <div class="col-sm-9">
                            <div class="outer">
                                <div class="inner">
                                    <figure>
                                        <?php echo teo_get_avatar($auth->ID, 90, 90);?>
                                    </figure>
                                    <div class="text">
                                        <div class="outer">
                                            <div class="inner">
                                                <a class="user-name"><?php echo $auth->display_name;?></a>
                                                <div class="counters"><?php echo $kudos . ' '; _e('kudos', 'Aruna');?></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-3">
                            <div class="outer">
                                <div class="inner">
                                    <div class="counter-item">
                                        <span class="number"><?php if($kudos >= 1000) echo $kudos / 1000; else echo $kudos; ?></span><br>
                                        <span class="exp"><?php _e('kudos', 'Aruna');?></span>
                                    </div>
                                    <div class="counter-item">
                                        <span class="number"><?php echo count_user_posts($auth->ID);?></span><br>
                                        <span class="exp"><?php _e('posts', 'Aruna');?></span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-9">
                        <?php if($redux_demo['ad2'] != '') {
                            echo '<div class="header_ad">' . $redux_demo['ad2'] . '</div>';
                        } ?>
                        <div class="main-wrap">
                            <h1><?php printf(__('posts by %s', 'Aruna'), $auth->display_name);?></h1>
                            <div class="separator"></div>
                            <?php 
                            if ( have_posts() ) :
                                $count = 1;
                                while ( have_posts() ) : the_post(); 
                                    if($count == 3 && $redux_demo['ad3'] != '') {
                                        echo '<div class="header_ad ad_between">' . $redux_demo['ad3'] . '</div>';
                                    }
                                    get_template_part( 'content', get_post_format() );
                                    $count++;
                                endwhile; 
                                get_template_part('includes/pagination');
                            endif; 
                            ?>
                        </div>
                    </div>
                    <?php get_sidebar('right');?>
                </div>
            </div>
            <?php get_sidebar('left');?>
        </div>
    </div>
</section>
<link rel="canonical" href="http://www.20script.ir" />
<?php get_footer();?>