Skip Navigation

[Resolved] Can I display only part of the Address field value?

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 1 reply, has 2 voices.

Last updated by Minesh 2 years ago.

Assisted by: Minesh.

Author
Posts
#2520905
map.png

I've built a classifieds site, using Toolset Maps to manage location data. I want to display the location on the listing, but not the full address - ideally, I would just like to show the city.

I can easily go to Fields and Views > Address, and get a shortcode that shows something like: "123 Road Avenue, Toronto" but I don't want it to be too specific here, and would love a shortcode that would just show "Toronto". Is something like this available?

I haven't found any relevant documentation for this so far.

Another possibility would be something like the Canadian Classifieds site, Kijiji, where they show a map with a circle giving the approximate location. I've attached an image of how this looks. I'll go with whichever is easier though.

My site is at: hidden link

Thanks!

#2522337

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

To display only the part of the address from map address field value you will have to write custom shortcode for that where you should pass the current complete address string to that custom shortcode and the shortcode should return the only city name.

Here is the doc about how you can write custom shortcode that should help you:
- https://toolset.com/documentation/programmer-reference/adding-custom-code/how-to-create-a-custom-shortcode/
- https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code/

If you do not know how to do it, please get in touch with me and share admin access details and problem URL where you want to display the city and I'm happy to share solution.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. I have set the next reply to private which means only you and I have access to it.