Collapse comment section
-
Yes, you would need to modify the child-theme, but it can be done.
here is thread with some examples:
https://ww.wp.xz.cn/support/topic/plugin-jquery-collapse-o-matic-roll-your-own-elements-ideas/Thanks for the really quick response!
But I’m still a noob with this. The instruction is unclear to me.
1. Collapsible comments
Replace comment area with something like the following:Can you be more precise and please tell me in which file of my child theme I should add the code? Should it be added to it or replace something?
Thanks
-
This reply was modified 6 years, 11 months ago by
guiguilyon.
OK.
I got some help on my themes forum (Weaver Xtreme).
They said I have to go to comments.php of the theme and replaceecho ‘<div id=”comments”>’;
by
echo ‘<div id=”comments”>’;
echo ‘<div id=”commentCollapse” class=”collapseomatic”>’;and
echo “</div><!– #comments –>\n”;
by
echo “</div></div><!– #comments –>\n”;
I also added the code provided here
<span id=”commentCollapse” class=”collapseomatic”>
<?php
if ( comments_open() ) :
comments_popup_link(‘Leave a comment ↓’, ‘1 comment ↓’, ‘% comments ↓’);
endif;
?>
</span>
<span id=”swap-commentCollapse” class=”collapseomatic” style=”display: none;”>Collapse ↑</span>
<?php edit_post_link(‘Edit →’, ‘| ‘, ” ); ?></p><div class=”content_collapse_wrapper”><div id=”target-commentCollapse” class=”collapseomatic_content force_content_collapse”>
<?php comments_template( ”, true ); ?>
</div></div>Nice ! Now the comments section is hidden. But I can’t display it at all. There is no button to make it appear.
Do you have any idea to help me please? 🙂
The test website I’m testing thjis on is here
well, good for you for giving this a go!
on the page you linked to, we see that the<span id=”commentCollapse” class=”collapseomatic”>...is wrapped in a<style>tag. This is not good.Remove the wrapping <style> tags and we’ll take another look.
Again, just to be extra-clear: the issue is that the code you added is being wrapped in a style tag:
<style> <span id="commentCollapse" class="collapseomatic"> ... </style> -
This reply was modified 6 years, 11 months ago by
The topic ‘Collapse comment section’ is closed to new replies.
(@guiguilyon)
6 years, 11 months ago
Hi,
Can this plugin collapse the comment section of every post or page of a website?
I guess I could put a shortcode on every single post. But it would be too long. Could it be in the theme instead?
Thanks