Skip Navigation

[Resolved] I want the map to automatically default to a specific location

This support ticket is created 2 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by israelC 2 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#2419613

Two questions:

1) I added your custom code snippet into Toolset-> Settings-> Custom code and replaced the ID 123456 with my form post ID but it looks like the map location field is not validating and it's allowing me to enter anything else into the location field such as an email address.

2) I enabled pagination and it's a bit helpful. I want the map to automatically default to a specific location such as "Ontario, California" and I want it to show a default of listings within 20 mile radius of that location. Can you please provide me snippet and instructions on how to do it?

This is the code I have right now for my map,

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<!-- Start of pagination -->
<div class="form-inline">
<div class="form-group">
<label for="wpv-pager-nav-dropdown">[wpml-string context="wpv-views"]Go to page[/wpml-string]</label>
[wpv-pager-nav-dropdown output="bootstrap"]
</div>
</div>
<!-- End of pagination -->
<div class="row search-filters">
<div class="col-sm-12">
<div class="form-grouphorizontal">
[wpv-control-distance default_distance="10" default_unit="mi" distance_center_required="yes" compare_field="address" distance_center_url_param="maps_distance_center" distance_radius_url_param="maps_distance_radius" distance_unit_url_param="maps_distance_unit" inputs_placeholder="<span>Results within </span>%%DISTANCE%% of %%CENTER%%"]
<div class=" buttons">
[wpv-filter-submit type="button" output="bootstrap"][wpv-filter-reset type="button" output="bootstrap"]
</div>
</div>
</div>
</div>
<div class="row filters-submit">
</div>
[/wpv-filter-controls]
[wpv-filter-end]

#2419651

Hello,

There isn't such kind of built-in feature within Toolset Maps plugin, since you have already add a distance filter into the post view, you can not add another distance filter into it.

But it is possible with custom codes, for example:
Edit the code snippet "z-map-location-address", line 29~36:

add_filter('wpv_filter_query', function($query, $args, $view_id){
  if($view_id == 3373){
  	if(!isset($_GET['maps_distance_center']) || empty($_GET['maps_distance_center'])){
		$_GET['maps_distance_center'] = 'Ontario, California USA';
    }
  }
  return $query;
}, 9, 3);

It will setup the default value of address field as value: Ontario, California USA

More help:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

#2422765

Thank you, I have a couple of questions:

1) On the bottom of the map appears some shortcode, hidden link Can you remove it? This is the page?

2) How can I ensure that the photo file name does not appear at the bottom of the uploaded photos but that the "< Prev Next >" links and close X appear in the bottom white part of the photos? hidden link

#2422821

Q1) On the bottom of the map appears some shortcode
Removed.

Q2) How can I ensure that the photo file name does not appear at the bottom of the uploaded photos but that the "< Prev Next >" links and close X appear in the bottom white part of the photos?
Where and how can I see the problem? Please point out the problem page URL

#2422831

hidden link click on the thumbnail images to expand to see.

#2422837

I have done below modifications in your website:
Edit the layout "Single Profile":
hidden link
edit the Visual Editor cell "Row 3"

change line 6 from:
[types field='car-gallery' title='%%TITLE%%' alt='%%ALT%%' size='thumbnail' resize='proportional' separator=''][/types]
To:
[types field='car-gallery' title='' alt='%%ALT%%' size='thumbnail' resize='proportional' separator=''][/types]

Please check if it is what you want. thanks

#2423199

My issue is resolved now. Thank you!