1. $ = jQuery;
  2.  
  3. $(document).ready(function(){
  4.  
  5.     reorderCustomCircles();
  6.    
  7. });
  8.  
  9. /* Re-order the Custom Circles
  10.  * Based on the element to have an attribute of "data-order"
  11.  */
  12. function reorderCustomCircles() {
  13.  
  14.     var circles = $('.hentry'),
  15.         orderAttr = 'data-order';
  16.  
  17.     circles.each(function(){
  18.         $this = $(this);
  19.  
  20.         // If the circle has been set an order
  21.         if ( typeof $this.attr(orderAttr) !== 'undefined' && $this.attr(orderAttr) !== false) {
  22.  
  23.             var order = $this.attr(orderAttr),
  24.                 // Should only need to check nth-child for the order
  25.                 target = $this.siblings(':nth-child(' + order + ')');
  26.            
  27.             // Move the circle that has an order to that order
  28.             $this.insertAfter(target);
  29.         }
  30.  
  31.     });
  32.    
  33. }