Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Created March 3, 2013 21:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/5078389 to your computer and use it in GitHub Desktop.
Save Shelob9/5078389 to your computer and use it in GitHub Desktop.
Show wordpress posts in arbitrary order. Best for category page. Problem solves, as always, on WordPress Answers http://wordpress.stackexchange.com/questions/89148/how-to-order-posts-in-an-arbitrary-order
<?php
$custom_query = new WP_Query(array(
'post__in' => array(4, 9, 12 /* whatever your post ID's are here */),
'orderby' => 'post__in',
));
while ($custom_query->have_posts()) {
$custom_query->the_post();
get_template_part( 'content', get_post_format() );
}
foundation_pagination();
// restore the original query
wp_reset_query(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment