Disable OnClick button that loads comments Disqus

0

So, my theme has this "onClick" button with "comments" as the title. It serves to click and load my comments from Disqus, just below the post. The problem is: it gives error several times, showing only one blank area many times. It takes too long to load! So I'd like to show the Disqus section without the need to call this function with this button, which the Disqus section loads normally right after my post.

Here is the function.php of the theme:

 if ( !function_exists( 'mvpClickCommmentButton' ) ) {
function mvpClickCommmentButton($disqus_shortname){
    global $post;
    echo '
    <script type="text/javascript">
    jQuery(document).ready(function($) {
      $(".comment-click-'.$post->ID.'").on("click", function(){
        $(".com-click-id-'.$post->ID.'").show();
        $(".disqus-thread-'.$post->ID.'").show();
        $(".com-but-'.$post->ID.'").hide();
      });
    });
    </script>';
}

and here is the single.php:

<?php $disqus_id = get_option('mvp_disqus_id'); if ($disqus_id) { if (isset($disqus_id)) {  ?>

    <div id="mvp-comments-button" class="left relative mvp-com-click">
        <span class="mvp-comment-but-text">
            <?php comments_number(__( 'Comments', 'zox-news'), esc_html__('Comments', 'zox-news'), esc_html__('% Comments', 'zox-news')); ?>
        </span>
    </div><!--mvp-comments-button-->

    <?php $disqus_id2 = esc_html($disqus_id); mvp_disqus_embed($disqus_id2); ?>
    <?php } } else { ?>
    <?php $mvp_click_id = get_the_ID(); ?>

    <?php comments_template(); ?>
<?php } ?>

I've tried solving myself, but I do not know anything about Php and Javascript, just html + css and a bit of php and javascript structure, paar to edit minimal things. So I changed it this way:

<?php if ( comments_open() ) { ?>

    <?php $disqus_id = get_option('mvp_disqus_id'); if ($disqus_id) { if (isset($disqus_id)) {  ?>

        <?php $disqus_id2 = esc_html($disqus_id); mvp_disqus_embed($disqus_id2); ?>
        <?php } } else { ?>
        <?php $mvp_click_id = get_the_ID(); ?>

        <?php comments_template(); ?>
    <?php } ?>

<?php } ?>

In the hope that the Disqus section will load below my Related Posts, without the need to click the button and load the function, but it also does not show anything ... Just a blank space:

The Zox News theme does not have the option to disable this OnLick, so I hope you can help me with this :) I tried to use the universal code, but it also gives an error. It shows nothing, and the page is left with Error 505, I believe because of conflict with this function ... I do not know.

    
asked by anonymous 06.05.2018 / 01:58

0 answers