Skip to content

Instantly share code, notes, and snippets.

@joelpittet
Created November 27, 2012 03:34
Show Gist options
  • Save joelpittet/4152201 to your computer and use it in GitHub Desktop.
Save joelpittet/4152201 to your computer and use it in GitHub Desktop.
function get_property_1_listings() {
$args = array('post_type' => 'listing');
$loop = new WP_Query($args);
$content = '<ul class="listings">';
$count = 0;
while ($loop->have_posts()) {
$loop->the_post();
$address = get_field('address');
if ($address == 'Property 1') {
$count++;
$content .= '<li class="' . (($count % 2 == 0)? 'even': 'odd') . '">';
$content .= '<a href="' . get_permalink() . '">';
$content .= '<strong>' . get_field('unit') . '</strong><br />';
$content .= get_field('short_description') . '</a>';
$content .= '</li>';
}
}
$content .= '</ul>';
return $content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment