Adriano
Support threads created in the last 30 days: 0
Favorite Forum Topics
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Change what a map shows when there are no search results
Started by: daveG-7
in: Toolset Professional Support
Problem: The client wanted to change the zoom accordingly the results of the View. If it doesn't return any results, then the zoom should be different. Solution: 1. Call the map render as last thing in the layout [wpv-layout-start] [wpv-items-found] <!-- wpv-loop-start --> <ul class="wpv-loop js-wpv-loop"> <wpv-loop> <li>[wpv-post-body view_template="Loop item in posts"]</li> [wpv-map-marker map_id='map-4' marker_id='marker-[wpv-post-id]' marker_field='wpcf-address-test'][/wpv-map-marker] </wpv-loop> </ul> <!-- wpv-loop-end --> [/wpv-items-found] [wpv-no-items-found] [wpv-map-marker map_id='map-4' marker_id='marker-[wpv-post-id]' address='Rua Pedro Trogo - Santo Antônio, Juiz de Fora - State of Minas Gerais, Brazil'][/wpv-map-marker] [/wpv-no-items-found] [wpv-map-render map_id='map-4' marker_icon='http://localhost:8888/teste/wp-content/plugins/views-addon-maps/resources/images/markers/Buildings.png'] [wpv-layout-end] Now use a Views JavaScript front-end event to change the zoom dynamically: jQuery( document ).on( 'js_event_wpv_addon_maps_init_map_started', function( event, data ) { if (WPViews.view_addon_maps.maps_data[0].markers[0].marker == 'marker-123'){ data.map_options.single_zoom = 1; } }); First you will need to define an ID for your marker in the wpv-map-marker shortcode inside of no items found. Then use the same ID in the code above and your zoom can be adjusted. |
|
2 | 6 | 8 years, 5 months ago | |
How can I group views by custom field
Started by: michaelR-12 in: Types Community Support |
|
2 | 8 | 10 years, 2 months ago |
Forum Topics Created
This user has not created any topics.