<?php
/**
 * The template for displaying archive pages
 *
 * @link    https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package wpstream-theme
 */

get_header();
$author_id=get_queried_object_id();
$author_name = get_the_author_meta( 'display_name', $author_id );
$wpstream_page_sidebar 		= 	intval(	get_theme_mod( 'wpstream_archive_sidebar', 'yes' ) );

$image_id            = get_the_author_meta( 'custom_picture_small', $author_id );
wpstream_load_player_js_on_demand();


$user_custom_picture = wp_get_attachment_url($image_id);
$author_first_name = get_the_author_meta( 'first_name', $author_id );
$author_last_name = get_the_author_meta( 'last_name', $author_id );
?>

<div class="wpstream_archive_header_holder">

				<!-- Header -->
				<div class="wpstream_archive_header_title_wrapper ">

                    <?php
                    if ( !empty( $user_custom_picture ) ) {
                    ?>
                    <img id="profile-image"
                         class="wpstream-dashboard-account__profile-image"
                         src="<?php echo esc_url( $user_custom_picture ); ?>"
                         alt="<?php esc_attr_e( 'user image', 'hello-wpstream' ); ?>"
                    >
                    <?php } ?>

					<div class="wpstream-theme-author-details">
						<?php
                        the_archive_title( '<h1>', '</h1>' );
                        if ( !empty( $author_first_name ) || !empty( $author_last_name ) ) {
                        ?>
						<div>
							<strong>
								<?php print esc_html__('Full Name','hello-wpstream').': '?>
							</strong>
							
							<?php echo esc_html($author_first_name.' '.$author_last_name) ;?>
						</div>
                        <?php } ?>
						<?php the_archive_description( '<div class="archive-description col-md-9">', '</div>' ); ?>
					</div>
				</div>


</div>




	<div id="content" class="site-content  <?php echo esc_attr( wpstream_theme_container_class() ); ?>">
		<div id="primary" class="content-area">

			<?php wpstream_bs_after_primary(); ?>

			<main id="main" class="site-main">

	

				<!-- Post List -->
				<div class="row">
					<?php if ( 1 === $wpstream_page_sidebar ) { ?>
						<div class="col col-md-8 col-lg-9 row wpstream-grid-container">
					<?php } else { ?>
						<div class="col col-md-12 col-lg-12 row wpstream-grid-container">
					<?php } ?>	
						<!-- Grid Layout -->
						<?php                  
					    print trim(wpstream_create_author_archive_lists( $author_id,'','', '' )); 
						?>
					</div>
					<!-- col -->
					<?php if ( 1 === $wpstream_page_sidebar ) {
						get_sidebar();
					 } ?>
				</div>
				<!-- row -->
			</main><!-- #main -->

		</div>
	</div>

<?php
get_footer();