Skip to content

Instantly share code, notes, and snippets.

@archon810
Created January 11, 2013 20:29
Show Gist options
  • Save archon810/4513724 to your computer and use it in GitHub Desktop.
Save archon810/4513724 to your computer and use it in GitHub Desktop.
try {
$query = array ("posts_per_page" => 5 , "tag" => "series_google_play_store_download");
$my_wp_query = new WP_Query($query);
$count = 0;
$my_post_id = get_the_ID();
echo "[warning]";
while ($my_wp_query->have_posts()) {
$count++;
$my_wp_query->the_post();
$my_title = get_the_title();
$my_link = get_permalink();
if($count == 1) {
if($my_post_id == get_the_ID()) {
echo "<b>This is the latest Play Store version.</b><p>You can find previous versions here:<p><ul>";
echo "<li><a href='" . $my_link . "'>" . $my_title . "</a></li>";
} else {
echo "<b>There is a more recent version of the Play Store available for download here: ";
echo "<a href='" . $my_link . "'>" . $my_title . "</a></b><p>";
echo "And a few earlier ones:<ul>";
}
} else {
echo "<li><a href='" . $my_link . "'>" . $my_title . "</a></li>";
}
}
echo "</ul>[/warning]";
} catch (Exception $e) {
echo $e->getMessage();
}
wp_reset_query();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment