月別、年別アーカイブの作り方
月別(年別)のアーカイブの表示
こちらは初期値(月別)のままつかっている状態です。wp_get_archives()関数
    <ul class="bottom-category">
        <?php wp_get_archives(); ?>
    </ul>こちらは年別です。yearlyに変えるだけですごく簡単です!
<ul class="bottom-category font32">
        <?php wp_get_archives('type=yearly'); ?>
</ul>ドロップボックスで月別(年別)アーカイブの表示
ドロップボックスの、クリックしたら表示させるバージョンです。スペースがない時や、そういうデザインのときに使えます。
<div class="dropbox">
				<select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'> 
					
					<?php wp_get_archives(array( 'type' => 'monthly', 'format' => 'option')); ?>
				</select>	
</div>少しcssでデザインを整えてます。
.dropbox {
  width: 30%;
  cursor: pointer;
  margin-top: 3vw;
  margin-bottom: 5vw;
  position: relative;
}
select {
  cursor: pointer;
  border: solid 1px #ccc;
  padding: 5px 20px;
  width: 100%;
  position: relative;
  z-index: 1;
}
.dropbox::after {
  position: absolute;
  right: 5px;
  top: 5px;
  content: '>';
  cursor: pointer;
  color: #000;
}jQueryと合わせてドロップボックスを作る
クリックした画面のカスタマイズが必要で、このような形態で作ってみました。
ちょっと長くなるけれど、ハンバーガーメニューをクリックしたときのsp-menuの動きと同じ感じで作りました。
                    <ul class="year-flex">
                        <li>Year > all</li>
                        <li class="border year_btn">></li>
                        <div class="year_archive">
                            <?php wp_get_archives('type=yearly'); ?>
                        </div>
                    </ul>  /*--カテゴリ一覧 ドロップボックス-----------*/
  
  .year_archive {
  display: block;
  position: absolute;
  z-index: 2;
 top: 0;
  right: 0;
  color: #333;
  background: #fff;
  text-align: center;
  width: 30%;
  margin-left: auto;
  padding: 10px 0;
  height: auto;
  opacity: 0;
  display: none;
  transition: opacity .6s ease, visibility .6s ease;
}
/* クリックでjQueryで追加・削除 */
.year_archive.active {
  opacity: 100;
  display: block;
}
.year_btn {
  cursor: pointer;
}
  /*#mask-----------------------------------*/
  #mask {
    display: none;
    transition: all .5s;
  }
  .open #mask {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ccc;
    opacity: .8;
    z-index: 2;
    cursor: pointer;
  }// 年別アーカイブ
jQuery(function($){
    $('.year_btn').click(function() {
        $(this).toggleClass('active');
 
        if ($(this).hasClass('active')) {
            $('.year_archive').addClass('active');
        } else {
            $('.year_archive').removeClass('active');
        } 
      
    });
});
//メニュー内を閉じておく
$(function() {
    $('.year_archive a[href]').click(function() {
        $('.year_archive').removeClass('active');
       $('.year_btn').removeClass('active');
    });
  });
  
  
  
  
