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

get_header();
?>

<div class="iz-pagebody iz-pagebody--author iz-pagebody--wsidebar">
	<div class="iz-pagebody__corset">

		<?php get_template_part( 'template-parts/newsticker' ); ?>

		<main id="primary" class="iz-main iz-main--wlisting">

			<?php if ( have_posts() ) : ?>

			<header class="page-header<?php if ( is_author() ) { ?> page-header--author<?php } ?>">
					<?php
					the_archive_title( '<h1 class="iz-heading iz-heading--page">', '</h1>' );

					if ( $curauth->user_description !== "" ) {
						the_archive_description( '<p class="archive-description">', '</p>' );
					}

					if ( is_author() ) {
						// Set the Current Author Variable $curauth
						$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
					?>
					<div class="iz-avatar">
						<?php echo get_avatar( $curauth->user_email , '150 '); ?>
					</div>
					<?php } ?>
					<?php if ( $curauth->user_url ) { ?>
					<p class="iz-website">
						Website: <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->user_url; ?></a>
					</p>
					<?php } ?>
				</header><!-- .page-header -->

				<?php
				/* Start the Loop */
				while ( have_posts() ) :
					the_post();

					/*
						* Include the Post-Type-specific template for the content.
						* If you want to override this in a child theme, then include a file
						* called content-___.php (where ___ is the Post Type name) and that will be used instead.
						*/
					get_template_part( 'template-parts/content', 'izlisting' );

				endwhile;

				the_posts_navigation();

			else :

				get_template_part( 'template-parts/content', 'none' );

			endif;
			?>

		</main><!-- #main -->
		<?php get_sidebar(); ?>
	</div><!-- .iz-pagebody__corset -->
</div><!-- .iz-pagebody -->


<?php get_footer(); ?>