Skip to content

Instantly share code, notes, and snippets.

@robwilde
Created December 18, 2014 09:39
Show Gist options
  • Select an option

  • Save robwilde/00bae4e0f118eb1d8b35 to your computer and use it in GitHub Desktop.

Select an option

Save robwilde/00bae4e0f118eb1d8b35 to your computer and use it in GitHub Desktop.
Retirement Living Units for Sale
<?php
/**
* Retirement Living Units for Sale
*/
//Get The Location
$current_location = get_post( get_the_ID() ); // get_the_ID() returns the ID of the current post
$args = array(
'post_type' => 'unit_sales',
'meta_query' => array(
array(
'key' => 'location',
'value' => ( $current_location->post_type == 'unit_sales'),
'compare' => 'LIKE',
)
)
);
//run the query and get results on compare
$location_query = new WP_Query($args);
if ($location_query) {
$out .= '<li class="icon_pos sale"><a href="' . trailingslashit( get_bloginfo( 'url' ) ) . 'retirement-living/units-for-sale/?location=' . $post->ID . '">Units For Sale</a></li>';
}
// must reset wp_query
wp_reset_query();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment