Hello
I use EventOn plugin for events, I could integrate that without problem with Toolset, it has a CPT called Events. I set up another CPT called Helyek (means Places) and the map addres is set here. When I want to show just Helyek on map, that works perfectly.
But I need to show the Events too on map, and the location is stored in the other post type. I created a many-to-many relationship between the two, it works as supposed. I set up the Helyek for every event too. Please help me how to set up the query and create the loop for the markers.
When this works I'll have to create a frontend filter form for showing only Events or only Places. If Events is selected its category list should appear to filter the markers, the same with Places. If this is not possible I can split this in different pages with different maps for each CPT, but it would be nice to have both CPTs on the same map with filtering.
Hello,
Where do you want to display the google map?
I assume we are talking about this: it is another wordpress page, with a post view, querying "Helyek" posts, you are going to display the related "event" posts title/link of each "Helyek" post.
If it is, you need to setup a nested view:
1) Parent view, querying "Helyek" posts, in the Views loop, display below child view:
2) Child view, querying "event" posts, filter by the post type relationship:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/
And display the "event" posts information, for example post title/link
Hi
I want to show the events as markers on a map on the Events page. Not just one marker but the markers of all the events in a given period. Events don't have an adress field they should get it from the linked Place (Hely if you view it in my admin). I linked the two with many-to-many relationship. I am not talking now about a post grid. That is not a problem for me. I have problem only with showing the Event markers - which actually is a Place the event takes place in, and inside the marker popup I will show the title and the date.
I also want to show Places on the Places page, but this is easy and working. Places are like theaters, restaurants, squares or anything in the city that can host an event.
I don't know how to set up the query, I tried yesterday already with setting a post relationship but I can't get the location from URL and I don't know how to get it as a shortcode parameter. I tried this approach but is not working for me: https://toolset.com/forums/topic/google-map-marker-from-parent-post-field/
The solution you've given me is not for my case or I don't understand it correctly...
I assume the Events page is a WordPress page,
You can setup a nested view:
1) Parent view, query "Events" posts, and display below child view
2) Child view, query "Helyek" posts, filter by the post type relationship between "Events" and "Helyek"
See above document:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
Section "Displaying many related items"
screen short
hidden link
You will need to use option "The current post in the loop"
And display the custom address field and map marker
It's not a single of Events post type. It's a page where I want to show a map with all my markers of events. I cannot use the option "The current post in the loop" because the current post is not a single event and this way I cannot pass the argument for the relationship filter to work.
Option "The current post in the loop" means post of parent view, so you can still setup this filter in the child view.
If you still need assistance for it, please provide a test site with the same problem, I can setup a demo for you.
Thanks for the details, I have done below modification in your website:
1) Parent view, query "Events" posts, display the map shortcode
hidden link
[wpv-map-render map_id="map-3" spiderfy="on"][/wpv-map-render]
In content template, display child view, and pass "Event" post ID to child view:
[wpv-view name="child-view-helyek-posts" eid="[wpv-post-id]"]
2) Child view, query "Helyek" posts, filter by the post type relationship between "Events" and "Helyek"
hidden link
Display the marker shortcode:
[wpv-map-marker map_id="map-3" marker_id='marker-[wpv-post-id]-[wpv-attribute name="eid"]' marker_field="wpcf-lokacio"]Helyek: [wpv-post-link] <br /> Event: [wpv-post-link id='[wpv-attribute name="eid"]'][/wpv-map-marker]
You can test it in front-end:
hidden link
Please check if it is what you want. thanks
In your example the markers show the Places (Helyek). I could achieve that already. I have to show the Events as markers. There could be 4 events in a month in the same place...
Yes, you are right, there are four markers in the map, if you can click the marker "Főtér" in the google map, you will see two markers are in the same address.
Yes, I see it now. I have to show the Event title as the marker popup, not the Place title. Can you help me with that too?
Yes, I have already done in your website, if you can click each marker, you will see different Helyek title + Event title, see my answer above:
https://toolset.com/forums/topic/show-markers-set-in-linked-post-type/#post-921554
[wpv-map-marker map_id="map-3" marker_id='marker-[wpv-post-id]-[wpv-attribute name="eid"]' marker_field="wpcf-lokacio"]Helyek: [wpv-post-link] <br /> Event: [wpv-post-link id='[wpv-attribute name="eid"]'][/wpv-map-marker]
The code display the place post link:
Helyek: [wpv-post-link]
Thank you Luo Yang! I understand it now and I can continue working on this project.