Last active
September 4, 2025 12:53
-
-
Save propertyhive/e3460e76e6feccbc895735cc973a8cfc to your computer and use it in GitHub Desktop.
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 | |
| // Place where you want this new section output: | |
| if ( isset($_GET['address_keyword']) && !empty($_GET['address_keyword']) ) | |
| { | |
| $address_keyword = sanitize_text_field($_GET['address_keyword']); | |
| $radius = 10; | |
| if ( isset($_GET['radius']) && !empty($_GET['radius']) ) | |
| { | |
| $radius = (int)$_GET['radius'] + 10; // add 10 miles to the radius already being searched | |
| } | |
| $exclude = array(); | |
| if ( have_posts() ) | |
| { | |
| while ( have_posts() ) | |
| { | |
| the_post(); | |
| $exclude[] = get_the_ID(); | |
| } | |
| } | |
| // Get properties | |
| $shortcode_output = do_shortcode('[properties exclude="' . implode(",", $exclude) . '" address_keyword="' . $address_keyword . '" radius="' . $radius . '" ]'); | |
| if ( !empty(strip_tags($shortcode_output)) ) | |
| { | |
| echo '<h3>We also found these nearby</h3>'; | |
| echo $shortcode_output; | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment