Skip to content

Instantly share code, notes, and snippets.

@jpen365
Created September 21, 2016 14:39
Show Gist options
  • Save jpen365/7a13478d695a4fc41664a3a4be046863 to your computer and use it in GitHub Desktop.
Save jpen365/7a13478d695a4fc41664a3a4be046863 to your computer and use it in GitHub Desktop.
<?php
$args = array(
'post_type' => 'post',
'cat' => '94',
'meta_key' => '_custom_post_order',
'orderby' => 'meta_value',
'order' => 'ASC'
);
$query = new WP_query ( $args );
if ( $query->have_posts() ) {
while ($query->have_posts() ) {
$query->the_post();
/* only list posts that have a current custom post order value */
if ( !empty(get_post_meta( $post->ID, '_custom_post_order', true )) ) : ?>
/* insert code for rendering posts */
<?php
endif; }
wp_reset_postdata();
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment