Skip Navigation

[Resolved] Search by postcode

This support ticket is created 6 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 5 replies, has 3 voices.

Last updated by aimeeL 6 years ago.

Assisted by: Waqar.

Author
Posts
#1192515

Do you have a search by postcode system available in the Google maps module? I see that a user can filter by distance from them or from a point of interest but I don't see anything about searching by postcode and the displaying custom posts on a map that are a certain distance from that postcode. Is this possible?

Regards,

David

#1192605

Hi David,

Thank you for waiting while I did some more research.

You'll find a useful code snippet and instructions on how you can extract the postcode information from the Google Maps response when a location address is saved.
https://toolset.com/forums/topic/separating-content-from-the-address-field/#post-522506

Once, you'll have the postcode value saved as a custom field value separately, you'll be able to use it for filtering results, same as other fields.

Note: for distance based calculations through, you'll still use the location field and not the new postcode field, as it will be just a numerical value.

I hope this helps.

regards
Waqar

#1192781

Hi Waqar,

The post code will already be part of the custom post as its own custom field so no need to extract it. My question is, is it possible to have a user search by post code for these custom posts using the filter by distance from that post code.

Regards,

David

#1192872

Hi David,

Thanks for clarifying that.

The filter by distance feature would work only from a location field (i.e. a point on the map) and not from a postcode.

A workaround can be to add a location field for each postcode and save a location on the map which lies roughly at the center of that postcode area.

That field can then be used for distance-based filters/comparisons.

regards,
Waqar

#1350683

Hi David...wondering how you resolved this? I'm trying to do the exact same thing you were asking about. Did you find a solution that works? Thanks!

#1350685

Hi David...wondering how you resolved this? I'm trying to do the exact same thing you were asking about. Did you find a solution that works? Thanks!