Okay
  Public Ticket #2440497
Display past events
Closed

Comments

  •  2
    laboulbene started the conversation

    Hi,

    I wonder if it is possible to display a map of past events (only) in order to present a retrospective of actions made.

    I have made a calendar for past events  and tried to assign each past event to this one, but it seems the events don't display. perhaps an option that I did not see ?

    I would prefer to keep the main calendar and show only past events with an appropriate shortcode :-)

    Thank you by advance and have a nice day,

    Ludovic


  •  877
    Zhivko replied

    Hi,

    Is it possible to provide me with link to the page to take a look?

    Could you paste me your shortcode here?


    Stachethemes Developer

  •  2
    laboulbene replied

    Hi,

    the link for current events : https://dev.defipourlenvironnement.org/nettoyage-de-la-nature/

    the link to page where I would like to display all past events together https://dev.defipourlenvironnement.org/retrospective/

    the sort code used : [stachethemes_ec cal="372" view="map" views="grid,map" gmap_focus="Paris, FR"]

    The calendar id the one used for the target calendar when an event is over

    This shortcake display the filters and I want to display all past events together. Event in may appears but I need to select the month of may. If I disable filters, there are also unavailable on current events maps.

    Another question : is it possible to center the map by geolocation (depending to visitor's location ) ?

    Thanks by advance,

    Ludovic

  •  877
    Zhivko replied

    Unfortunately, it's not possible to display all events at once because if some of the events are repeated indefinedely this will crash the browser. That's why we made it month by month.

    What you could do is set the calendar initial date in the past like this:

    [stachethemes_ec start_date=2020-05-01]


    I could provide you with custom code that will retrieve the user coordinates and center the map on them.

    Place the code in your theme/child-theme functions.php file:

    add_action('wp_footer', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                if (typeof $.stecExtend === 'undefined') {
                    return;
                }
                $.stecExtend(function (m) {
                    new Promise(function (resolve, reject) {
                        if (m.glob.options.map_focus) {
                            return resolve(m.glob.options.map_focus);
                        } else if (navigator.geolocation) {
                            navigator.geolocation.getCurrentPosition(function (e) {
                                return resolve([e.coords.latitude, e.coords.longitude].join(','));
                            }, function(){
                                reject();
                            });
                        } else {
                            return reject();
                        }
                    }).then(function (coordinates) {
                        m.glob.options.map_focus = coordinates;
                    }).catch(function(){
                        console.log('Unable to get coordinates');
                    });
                });
            })(window.jQuery);
        </script>
        <?php
    });
    

    Note: this code requires calendar version 3.0.8 in order to work.


    Stachethemes Developer