In the while, because you helped me in the past with the code can i take this opportunity to ask you about a toolset code integration ?
I would help to integrate a shortcode to order posts based on a custom field. I Would create a view in a location cpt to sort nearest location(s) to that.
I have a "location" post type
I would create a view inside the location post template
This views shows the nearest location to the actual ordered by distance.
I can't see any views to choose a custom field as distance from this, so i would create an extension to this
I understand better now, thank you. You would like to filter by distance and order the results by distance as well. It requires a bit of custom code, and I helped another client with a similar setup. Please review this forum ticket and let me know if you have questions about implementing this solution: https://toolset.com/forums/topic/sorting-views-by-distance-to-current-post-geolocation/
I'll be glad to give you more feedback if you have concerns.
Can you share all the code you used so I can see the exact changes you made?
1. The wpv-view shortcode used to display the map
2. The toolset-maps-distance-view shortcode used to display the distance
3. The full PHP code snippet to filter wpv_view_settings
I will review the changes and give you some feedback.
Hi, the locali-intorno-a-questo View shortcode seems to be formatted incorrectly, which will cause a problem with the distance calculation. Please try this change:
If this does not resolve the problem, I'll be glad to take a closer look in wp-admin. Please provide login credentials here and let me know where I can see this content on the front-end of the site.
The topic ‘[Closed] Shortcode to sort posts’ is closed to new replies.