11.02.2021: There may be a delay in tickets response in the next couple of days. We apologise for any inconvenience caused.


Okay
  Print

Displaying Different Views for Desktop and Mobile Devices

This article will show you how to display two different views one for Desktop and one for Mobile device.
Simply open your active theme functions.php file and at the bottom paste following code:

add_action('wp_footer', function() {
    global $post;
    if (!is_a($post, 'WP_Post') || !has_shortcode($post->post_content, 'stachethemes_ec')) {
        return;
    }
    ?>
    <script type="text/javascript">
        (function ($) {
            $(function () {
                if (typeof $.stecExtend === 'undefined') {
                    return;
                }
                // config vars
                var mobileView = 'grid';
                var normalView = 'agenda';
                $.stecExtend(function (m) {
                    m.glob.options.view = m.helper.isMobile() ? mobileView : normalView; 
                });
            });
        })(window.jQuery);
    </script>
    <?php
});

To change the mobile view just edit this line: var mobileView = 'grid';

And for Desktop this one: var normalView = 'agenda';