php - jQuery: isotope, sorting by date -


i'm having trouble sorting isotope elements dates, elements being wordpress posts, date getting pulled in php.
html / php:

<div id="blog-grid">  <div class="blog-grid date" data-time="<?php the_time('y-m-d h:i:s') ?>"> </div>  <div class="blog-grid-text date" data-time="<?php the_time('y-m-d h:i:s') ?>"> </div>  </div> 

jquery:

$(window).load(function(){  var $container = $('#blog-grid');  $container.imagesloaded( function(){ $container.isotope({     itemselector: '.blog-grid, .blog-grid-text', sortby: {     time: function( $elem ) {       return $elem.find('.date').attr('data-time');     }   },     animationengine: 'best-available',     masonry: {     columnwidth: 3,     gutterwidth: 20     } });     });    }); 

this doesn't seem work, can't find solution does. date can in format if helps, i'm not sure how sort these posts date (descending). suggestions appreciated!

format dates unix timestamp first. way sort integer value. pass time-string strtotime() convert easily.

then don't temember, think need set default sorting well. set time in case.


Comments