Skip to content

Instantly share code, notes, and snippets.

@sproutventure
Created March 18, 2011 18:15
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 sproutventure/876556 to your computer and use it in GitHub Desktop.
Save sproutventure/876556 to your computer and use it in GitHub Desktop.
Returns some GBS deals
<?php
global $wp_query;
$add_deal_query= null;
$args=array(
'post_type' => 'deal',
'post_status' => 'publish',
'meta_key' => $gb->_metaDealExpiration, // Make sure the deal is not exprired
'posts_per_page' => 3, // return this many
'post__not_in' => array( $wp_query->post->ID ) // do not show the current deal within this loop
);
$add_deal_query = new WP_Query($args);
if ($add_deal_query->have_posts()) {
/* Before loop */
while ($add_deal_query->have_posts()) : $add_deal_query->the_post();
?>
<li><?php the_title() ?>Other stuff...</li>
<?php
endwhile;
/* After loop */
}
$add_deal_query = null; $add_deal_query = $temp;
wp_reset_query();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment