Skip to content

Instantly share code, notes, and snippets.

@bonny
Created February 22, 2013 09:37
Show Gist options
  • Save bonny/5012104 to your computer and use it in GitHub Desktop.
Save bonny/5012104 to your computer and use it in GitHub Desktop.
<?php
// Loop through a wp query obj
$wp_query_obj = new wp_query('post_type=regions&posts_per_page=3&orderby=title&order=asc');
with_posts($wp_query_obj, function($post, $arr_info) {
echo "<p>I am post number" . $arr_info["current_post"] . " of " . $arr_info["post_count"] " found post(s).</p>";
echo "<p>My title is: " . get_the_title() . "</p>";
echo "<p>And my slug is: " . $post->post_name . "</p>";
});
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment