Skip Navigation

[Resolved] adress field widget input

This support ticket is created 4 years 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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Waqar 4 years ago.

Assisted by: Waqar.

Author
Posts
#2072373

i would like to use a nice widget for adress field ( toolset legacy ), at this moment i need to write this format:

city/country , and then all time in map or results, it displays cuntry and its ugly cause its always the same and not needed.

so, 2 questions:
**how can i use another widget for input adress field ( like automatic selection on a map or a search box ), not just text writing.
** how can i choose which info in adrees field to display in the map or results view ( so avoid displaying country part all time)

#2072645

Hi,

Thank you for contacting us and I'll be happy to assist.

To make sure that the results in the distance search field are restricted to only a particular country, for example, "UK", you can include the following code in your View's "JS editor" tab, under the "Loop Editor" section:


jQuery(".js-toolset-maps-distance-center").geocomplete({country: 'UK',type: []});

Note: please replace the UK with a two-digit country code of your choice.

I hope this helps and if you have a different requirement, you're welcome to share some more details along with the example page.

regards,
Waqar

#2073517
Capture.PNG

hello, i mean input field when adding adrees in a custom field:here, look at attachment

#2073529
Capture.PNG

and this: how to only display part of adress field: using this code:

<h6>[wpv-post-field name="wpcf-ubicacion"]</h6>

i do not want to display country in results

#2074775

Thanks for writing back.

I'm afraid, the way the address field works, it won't be possible to stop it from saving the country's name.

However, you can remove the country's name "España" from the front-end output using a custom shortcode:


add_shortcode('strip_word_output', 'strip_word_output_func');
function strip_word_output_func( $atts ) {

	$a = shortcode_atts( array(
		'field' => '',
		'word' => '',
	), $atts );

	$field_value = types_render_field( $a['field'], array( 'output' => 'raw' ) );

	return str_replace($a['word'], "", $field_value);;
}

The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through the active theme's "functions.php" file.

After that, you can replace the field's code from:


<h6>[wpv-post-field name="wpcf-ubicacion"]</h6>

To:


<h6>[strip_word_output field='ubicacion' word=', España']</h6>

And in the field's output on the front-end the ", España" part will be stripped.