php - Sort by date using Isotope, breaking down into day/months/years -
i using isotope arrange , sort bunch of elements. have buttons controlling sorting.
i can't 'date' sorting work properly. have date being printed inside each element sorted , applied class of .date it. prints dd/mm/yy
<span class="date"><?php the_date('d/m/y');?></span>
in simplest form can sort using -
getsortdata: { date: '.date', }
this organise number order fine days goes wrong when comes months. how can sort sort true date rather number.
i have tried using examples i've found on stackoverflow each 1 breaks isotope , elements not layout. below example of sort have work, maybe can use see need do?
distance: function( itemelem ) { var distance= $( itemelem ).find('.wppl-address').text(); return parsefloat( distance.replace( /[\(\)]/g, '') ); },
have php output :
<span class="date" data-date="<?php the_date('c');?>" > <?php the_date('d/m/y');?> </span>
then use :
getsortdata: { date: function($item) { return $item.data('date'); } }
or try out:
getsortdata: { date: function($item) { return new date($item.data('date')); } }
Comments
Post a Comment