Created
December 18, 2014 09:39
-
-
Save robwilde/00bae4e0f118eb1d8b35 to your computer and use it in GitHub Desktop.
Retirement Living Units for Sale
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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