Skip to content

Instantly share code, notes, and snippets.

@hunk
Created September 4, 2010 05:00
Show Gist options
  • Save hunk/564916 to your computer and use it in GitHub Desktop.
Save hunk/564916 to your computer and use it in GitHub Desktop.
<?php
$my_query = new WP_Query('category_name=portafolio&showposts=-1&meta_key=show-date');
$new_order = array();
while ($my_query->have_posts()) : $my_query->the_post();
$new_order[strtotime(get('show-date'))] = get_the_id();
endwhile;
ksort($new_order); // ksort => ASC
//krsort($new_order); // krsort => DESC
foreach($new_order as $new){
$my_query2 = new WP_Query(array('p' => $new));
while ($my_query2->have_posts()) : $my_query2->the_post();
the_title();
echo get('show-date');
echo "<br />";
endwhile;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment