Hello, can someone help me hide the comments form and show it when someone clicks a button?
This what’s I’m trying to hide:
I’ve found a snippet to show the comments on click, maybe we can change the code to work with the comments form as well.
function your_hidden_comments(){ ?>
<script type=”text/javascript” defer=”defer”>
var comment_div = jQuery(‘#comments’);
if(comment_div[0]){
jQuery(‘<button id=”show_comments”>Show Comments</button>’).insertBefore(comment_div);
comment_div.hide();
jQuery(‘#show_comments’).on(‘click’,function(){ comment_div.fadeIn(‘slow’); jQuery(‘#show_comments’).fadeOut(‘slow’); });}
</script>
<?php }
add_action(‘wp_footer’, ‘your_hidden_comments’);
This is a post of mine:
(NSFW content)
Thank you in advance 🙂