Skip to content

Instantly share code, notes, and snippets.

@SauntValerian
Created July 12, 2017 19:51
Show Gist options
  • Save SauntValerian/f2a50206575072475911ba6d90f0412b to your computer and use it in GitHub Desktop.
Save SauntValerian/f2a50206575072475911ba6d90f0412b to your computer and use it in GitHub Desktop.
// Don't use multiple loops here. Loop through all your posts once, and store each post into an array depending on which tier it falls into. E.g.
$tiers = array(
'platinum' => array(),
'gold' => array(),
'silver' => array(),
'bronze' => array()
);
//Afterwards, the array should be populated with posts. Loop through the array and handle it accordingly.
foreach ( $tiers as $level => $posts ) {
foreach ( $posts as $post ) {
// output each post
// do some fancy output using $level if needed
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment