Last active
April 16, 2022 08:16
-
-
Save CaiJimmy/38a94ae184c727584a50bf5772e51d2f to your computer and use it in GitHub Desktop.
Ghost Archive Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
if($('#archivePage').length){ | |
var $item = $('.archiveList--item'), | |
dates = {}; | |
$item.each(function(){ | |
dates[$(this).data('date')] = ''; | |
}); | |
for (date in dates) { | |
$item.filter('[data-date='+ date +']').wrapAll('<ul class="archiveList"></ul>'); | |
}; | |
$('.archiveList').each(function() { | |
var month = $(this).children().first().data('date').replace("-"," "); | |
$(this).attr('data-date', month); | |
}); | |
}; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment