<?php
get_header();
?>
<div class="main">
	<?php
	while ( have_posts() ) :
		the_post(); ?>

		<?php
		if ( has_post_thumbnail() ) {
			$banner_img_src = get_the_post_thumbnail_url();
			sbwhea_add_banner_css( $banner_img_src );
		}
		?>

		<div id="page-banner">
			<div class="overlay"></div>
		</div>

		<div class="container">
			<div class="row justify-content-sm-center">
				<div class="col-sm-8">
					<main>
						<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
							<h1 class="page-title"><?php the_title(); ?></h1>
							<div class="entry-content">
								<?php the_content();

								wp_link_pages(
									array(
										'before' => '<div class="page-links">' . __( 'Pages:', 'sbw-wedding' ),
										'after'  => '</div>',
									)
								);
								?>
							</div><!-- .entry-content -->

							<footer class="entry-footer">
								<?php
								printf(
									/* translators: 1: SVG icon. 2: post author, only visible to screen readers. 3: author link. */
									'<span class="byline">%1$s<span class="screen-reader-text">%2$s</span><span class="author vcard"><a class="url fn n" href="%3$s">%4$s</a></span></span>',
									'<i class="fas fa-user"></i>',
									__( 'Posted by', 'sbw-wedding' ),
									esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
									esc_html( get_the_author() )
								);

								$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
								if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
									$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
								}

								$time_string = sprintf(
									$time_string,
									esc_attr( get_the_date( DATE_W3C ) ),
									esc_html( get_the_date() ),
									esc_attr( get_the_modified_date( DATE_W3C ) ),
									esc_html( get_the_modified_date() )
								);

								printf(
									'<span class="posted-on">%1$s<a href="%2$s" rel="bookmark">%3$s</a></span>',
									'<i class="fas fa-clock"></i>',
									esc_url( get_permalink() ),
									$time_string
								);

								/* translators: used between list items, there is a space after the comma. */
								$categories_list = get_the_category_list( __( ', ', 'sbw-wedding' ) );
								if ( $categories_list ) {
									printf(
										/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of categories. */
										'<span class="cat-links">%1$s<span class="screen-reader-text">%2$s</span>%3$s</span>',
										'<i class="fas fa-folder"></i>',
										__( 'Posted in', 'sbw-wedding' ),
										$categories_list
									); // WPCS: XSS OK.
								}

								$tags_list = get_the_tag_list( '<i class="fas fa-tag"></i>', ', ' );
								if ( $tags_list ) {
									printf(
										/* translators: 1: SVG icon. 2: posted in label, only visible to screen readers. 3: list of tags. */
										'<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
										__( 'Tags:', 'sbw-wedding' ),
										$tags_list
									);
								}
								?>
							</footer><!-- .entry-footer -->

						</article>

						<?php

						the_post_navigation(
							array(
								'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next post:', 'sbw-wedding' ) . '</span> ' .
									'<span class="screen-reader-text">' . __( 'Next post:', 'sbw-wedding' ) . '</span> <br/>' .
									'<span class="post-title">%title</span>',
								'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous Post:', 'sbw-wedding' ) . '</span> ' .
									'<span class="screen-reader-text">' . __( 'Previous post:', 'sbw-wedding' ) . '</span> <br/>' .
									'<span class="post-title">%title</span>',
							)
						);

						// If comments are open or we have at least one comment, load up the comment template.
						if ( comments_open() || get_comments_number() ) {
							comments_template();
						}
						?>
					</main>
				</div>
			</div>
		</div>
	<?php endwhile; ?>
</div>

<?php
get_footer();
