<?php
get_header();
?>
<div class="imgArea">
</div>
<div class="breadArea">
  <ul class="inner">
    <li><a href="<?php echo home_url('/'); ?>">TOP</a></li>
    <li>NEWSLIST</li>
    </ul>
</div>
<div class="ttlArea">
  <div class="inner">
    <div class="h1Area newslist">
      <h1>新着情報</h1>
    </div>
  </div>
</div>
<section>
	<div class="newslistArea">
		<div class="inner">
			<div>
				<ul class="listArea">
					<?php
					$args = [
						"posts_per_page" => 10,
						'paged' => get_query_var('paged') ? get_query_var('paged') : 1,
						"post_type" => "post",
						"orderby " => "date",
						"post_status" => "publish",
						"category_name" => get_queried_object()->slug
					];
					$the_query = new WP_Query($args);
					while ($the_query->have_posts()) {
						$the_query->the_post();
//						$cat = get_the_category();
//						$cat = $cat[0];
					?>
						<li class="icon <?php echo $cat->slug; ?>">
							<div class="date">
								<time><?php the_time("Y.m.d"); ?></time>
							</div>
							<div class="ttl">
								<a href="<?php the_permalink(); ?>">
									<p><?php echo mb_strimwidth(get_the_title(), 0, 250, "..."); ?></p>
								</a>
							</div>
						</li>
					<?php
					}
					?>
				</ul>
<?php
$big = 9999999999;
$arg = [
 "base" => str_replace($big, "%#%", esc_url(get_pagenum_link($big))),
 "current" => max(1, get_query_var("paged")),
 "total" => $the_query->max_num_pages,
 "prev_text" => "＜",
 "next_text" => "＞"
];
if(paginate_links($arg)){
 echo "<div class=\"pager\">".paginate_links($arg)."</div>";
}
wp_reset_postdata();
?>
			</div>
		</div>
	</div>
</section>
<?php get_footer(); ?>