0
So my theme has this "onClick" button with "comments" as its 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! So I’d like to show the Disqus section without the need to call this function with this button, that the Disqus section normally loads 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 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 tried to solve it myself, but I don’t know anything about Php and Javascript, just html+css and a bit of php and javascript structure, to edit minimal things. So I changed that 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 would click below my Related Posts, without the need to click the button and press the function, but it also shows nothing... 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 using universal code, but it also gives error. It shows nothing, and the page gets Error 505, I believe that by conflict with this function... I do not know.
Translate your question. The language here is English.
– Sam
sorry, I didn’t notice it was at the PT address.
– Aron Monteiro