Okay
  Public Ticket #1971650
Slow show up facebook comment
Closed

Comments

  • Steve started the conversation

    Hi,

    I hope you get well.

    I have an issue that when I click "Comments" tab, facebook comment show up after few seconds (almost 5-6 seconds), so my website users would be confused. If I use Disqus, would it show up faster than before?

  •  877
    Zhivko replied

    Hi,

    Since the comments come from external source (Facebook, Disqus) we've decided to load the comments form only when users click on the comments tab. The idea is to prevent unnecesery data requests because not all users want to view the comments section. Perhaps we could add some text for example "Comments will be displayed shortly" or something like that. 


    Stachethemes Developer

  • Steve replied

    Can you let me know how to add some text, "Comments will be displayed shortly" while it is loading.

  •  877
    Zhivko replied

    In your theme functions.php file at the bottom add:

    add_filter('stec_event_tabs', function($tabs) {
        foreach ($tabs as $k => $tab) {
            if ($tab[0] === 'comments') {
                $tabs[$k] = array("comments", __('Comments', 'stec'), "fas fa-comments", '<p class="stec-layout-event-text-fontandcolor">' . __('Comments will be displayed shortly', 'stec') . '</p>', false);
            }
        }
        return $tabs;
    }); add_action('stec_after_html', function() {
        ?>
        <script type="text/javascript">
            (function ($) {
                $.stecExtend(function (m, data) {
                    var interval = null;                 m.$instance.on(m.helper.clickHandle(), 'li[data-tab="stec-layout-event-inner-comments"]', function () {                     clearInterval(interval);                     interval = setInterval(function () {
                            var cLength = Math.max(0, m.$instance.find('.stec-layout-event-inner-comments')
                                    .find('.stec-fb-comments, #disqus_thread').length);                         if (cLength > 0) {
                                clearInterval(interval);
                                m.$instance.find('.stec-layout-event-inner-comments > p').remove();
                            }
                        }, 1000);
                    });
                });
            })(jQuery);
        </script>
        <?php
    });



    Stachethemes Developer

  • Steve replied

    It worked perfectly. One of my additional opinion is that the message disappeared after comments display.

  •  877
    Zhivko replied

    We'll tweak this in future update.


    Stachethemes Developer