GeoDirectory SupportHow would I add text from the "Near" field to appear in results after "distance" – GeoDirectory Support https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/feed Thu, 15 Jan 2026 20:24:07 +0000 http://bbpress.org/?v=2.5.14-6684 en-US https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20631 <![CDATA[How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20631 Wed, 05 Nov 2014 09:53:21 +0000 adriangraham Hi there,

When I type a value into the “near” field in “GD > Search” I think it would be great to have that value in the search results after the km/miles value…. so instead of it saying “Listing Title” and then for example “2.2 miles” or “2.2 km”… it would say “2.2 miles from Dublin” or whatever was typed into the near field.

What would be involved in doing this?

Thanks as always!

Adrian

]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20639 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20639 Wed, 05 Nov 2014 13:04:50 +0000 Simone Hi Adrian, it is a little bit tricky, but you can edit this and make it work:

open listing-listview.php in /wp-content/plugins/geodirectory/geodirectory_templates

find this block


<?php
					
					 if (round((int)$distance,2) == 0){
												$uom = get_option('geodir_search_dist_2');
												$distance = geodir_calculateDistanceFromLatLong ($startPoint,$endPoint,$uom);
												echo round($distance).' '.$uom.'<br />';
											}else{
												echo round($distance,2).' '.$uom.'<br />';
										}
					?>

it’s between row 77 and 86

replace this block with


<?php
					
					 if (round((int)$distance,2) == 0){
												$uom = get_option('geodir_search_dist_2');
												$distance = geodir_calculateDistanceFromLatLong ($startPoint,$endPoint,$uom);
												echo round($distance).' '.$uom.' from '.$_REQUEST['snear'].' <br />';
												
											}else{
												echo round($distance,2).' '.$uom.' from <br />';
										}
					?>

You will have the result, as per seen on the screenshot (tested on my demo site)

Sidenote: the modification needs to be redone if a GD update will be released.

]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20659 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20659 Wed, 05 Nov 2014 13:30:55 +0000 adriangraham Great fast reply Simone…. it works… but only listings in the EXACT area where you are searching and not even ones beside it

for example look at this URL with it implemented:

http://childcarefinder.ie/?geodir_search=1&stype=gd_place&s=+&snear=Artane&sgeo_lat=53.3830008&sgeo_lon=-6.205133100000012

and

http://childcarefinder.ie/?geodir_search=1&stype=gd_place&s=+&snear=Dublin+4&sgeo_lat=53.3260898&sgeo_lon=-6.243784399999981

and

http://childcarefinder.ie/?geodir_search=1&stype=gd_place&s=+&snear=Seabury+Park&sgeo_lat=53.4545275&sgeo_lon=-6.185807299999965

]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20665 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20665 Wed, 05 Nov 2014 13:35:57 +0000 Simone try this


		<?php
					
					 if (round((int)$distance,2) == 0){
												$uom = get_option('geodir_search_dist_2');
												$distance = geodir_calculateDistanceFromLatLong ($startPoint,$endPoint,$uom);
												echo round($distance).' '.$uom.' from '.$_REQUEST['snear'].' <br />';
												
												
											}else{
												echo round($distance,2).' '.$uom.' from '.$_REQUEST['snear'].' <br />';
												
										}
					?>
]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20666 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20666 Wed, 05 Nov 2014 13:39:54 +0000 adriangraham Works! Thanks

Note to anyone else using this…. I had to change the quotation marks in Simones reply as they were getting formatted wrong as it’s not in a CODE section above

I think this would be a nice change in the next release.

]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20667 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20667 Wed, 05 Nov 2014 13:41:00 +0000 Simone You copied fast, a second later it was in a code section 🙂

Glad it worked.

]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20668 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20668 Wed, 05 Nov 2014 13:41:28 +0000 adriangraham What great service. Thanks.

]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20722 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20722 Wed, 05 Nov 2014 19:07:37 +0000 Paolo BTW, if you move that template in your active theme inside a folder named geodirectory, you will not lose your changes after next update.

Thx

]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20725 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20725 Wed, 05 Nov 2014 19:19:04 +0000 adriangraham Paolo, this is interesting as I am worried about a couple of changes I’ve made getting over written…. can you explain exactly what you mean?

Thanks,

Adrian

]]>
https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20728 <![CDATA[Reply To: How would I add text from the "Near" field to appear in results after "distance"]]> https://wpgeodirectory.com/support/topic/how-would-i-add-text-from-the-near-field-to-appear-in-results-after-distance/#post-20728 Wed, 05 Nov 2014 19:42:44 +0000 Paolo Files in

plugins/geodirectory/geodirectory-templates/

can be copied in

themes/your-active-theme/geodirectory/ (folder to be created)

And the plugin will start using your copy of the file.

Thx

]]>