Skip to content

Instantly share code, notes, and snippets.

@mjhale
Created October 31, 2012 22:52
Show Gist options
  • Save mjhale/3990477 to your computer and use it in GitHub Desktop.
Save mjhale/3990477 to your computer and use it in GitHub Desktop.
<?php
$topListings = array();
$bottomListings = array();
for ( $i = 0; $i < count( $loop->posts ); $i++ ) {
if ( str_word_count( $loop->posts[$i]->post_content ) >= 30 ) {
array_push( $topListings, $loop->posts[$i] );
} else {
array_push( $bottomListings, $loop->posts[$i] );
}
}
shuffle( $topListings );
shuffle( $bottomListings );
$loop->posts = array();
$loop->posts = array_merge( $topListings, $bottomListings );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment