アーカイブページの作成
続いて、アーカイブページ用のテンプレートを作成します。
archive.phpをindex.phpをもとに作成します。
<?php 
//ヘッダーを取得
get_header('archive'); 
while(have_posts() === true){
  the_post(); 
  get_template_part('templates/content'); 
}
get_template_part('templates/pagination');
get_footer();
このように、get_headerに引数として、文字列を渡しておくとheader-[指定した文字列].phpというテンプレートが優先的に読み込まれるようになります。
今回は、アーカイブページ用のヘッダーとして header-archive.phpを作成します。
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
  <header>
    <h1>zero</h1>
    <h2>過去のアーカイブ</h2>
  </header>