Skip Navigation

[Resolved] legacy editor filter post distance using shortcode attribute

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 4 replies, has 2 voices.

Last updated by Minesh 11 months, 1 week ago.

Assisted by: Minesh.

Author
Posts
#2678801
loop_editor.jpg
Screenshot_distance-Filter.jpg

Tell us what you are trying to do?

Hi I spend a lot of research of similar problems but I didn't understood how to solve the problem.
I use the Divi Theme and Views Legacy Editor.
I have different city pages where I want to show up persons that are living in a distance of 150km of this city.
The Persons (Filterresults) should only show up in a grid.

So I chose the content, applied a distance filter and selected:
Distance center is set using shortcode attribute: mapcenter

I think the right shortcode to get there is this one:
[wpv-view name="filter-150" mapcenter="[types field='adresse-city' output='raw'][/types]" cached="off"]

Adress-Field Name of CitysPost: wpcf-adresse-city
Adress-Field Slug of CitysPost: adresse-city

Adress-Field Name of PersonsPost: wpcf-adresse
Adress-Field Slug of PersonsPost: adresse

I don't understand how to controll the filter with the shortcode attribute.
I don't understand where I have to put the shortcode in the edit view?
Loop editor or output editor? In the loop editor it's not working.
I try to understand how to use shortcodes in distance filter but your documentation and problems of other users get me into nowhere.

Is there any documentation that you are following?
https://toolset.com/forums/topic/filter-the-results-more-based-on-a-radius-of-the-post-types-respective-address-fields/

#2678840

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL where you are trying to display your view and what view you created as well as admin access details.

Let me review your structure and then I will be able to guide you in the right direction.

*** 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. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2678872

Minesh
Supporter

Languages: English (English )

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

I see you are using Toolset view module inside your divi builder to display the view you created.

Instead of using Toolset View module what if you try to use the following:
- Delete the view module using which you are displaying view currently.
- Add a text module
- Within the text module try to add the view's shortcode as given under:

[wpv-view name="view-slug" mapcenter="[types field='adresse-city' output='raw'][/types]" cached="off"]

- save the page

Can you please check the above steps help you to resolve this issue.

#2678963
Sort-By-Distance-to-post.png

alright, thank you very much. The first issue was solved really easy. Would be happier to solve it inside of the view but with the shortcode it's okey as well.
Can you please hide the filter-name for reasons of discretion?

Second step I asked was to sort it afterwards as a distance from the city post.
I tried it out with a fix address and it works great. But if I try it with toolset_maps_distance_center it doesn't work.

#2679112

Minesh
Supporter

Languages: English (English )

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

As per our support policy, we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery for the original issue reported with this ticket.

May I kindly ask you to open a new ticket with every new question you may have, even you can create a new ticket and assign it to me or share reference of the previous related ticket.

Thank you for understanding.

#2679128

Thank you. This helped