Skip to content

Instantly share code, notes, and snippets.

@Ollo
Last active December 15, 2015 17:09
Show Gist options
  • Save Ollo/5294359 to your computer and use it in GitHub Desktop.
Save Ollo/5294359 to your computer and use it in GitHub Desktop.
get latest download that isn't a release candidate
// echo latest download version for buttons
function get_latest_dl_ver() {
$args = array(
'post_type' => 'downloads',
'posts_per_page' => '1',
//'order' => 'DESC',
'orderby' => 'meta_value',
'meta_query' => array(
array(
'key' => 'rc',
'value' => '0',
'compare'=> '!='
)
)
);
$latest = new WP_Query($args);
while ( $latest->have_posts() ) : $latest->the_post();
the_title();
endwhile; wp_reset_postdata();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment