Title: Collapse comment section
Last modified: July 4, 2019

---

# Collapse comment section

 *  Resolved [guiguilyon](https://wordpress.org/support/users/guiguilyon/)
 * (@guiguilyon)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/collapse-comment-section/)
 * 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

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [twinpictures](https://wordpress.org/support/users/twinpictures/)
 * (@twinpictures)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/collapse-comment-section/#post-11700297)
 * Yes, you would need to modify the child-theme, but it can be done.
    here is thread
   with some examples: [https://wordpress.org/support/topic/plugin-jquery-collapse-o-matic-roll-your-own-elements-ideas/](https://wordpress.org/support/topic/plugin-jquery-collapse-o-matic-roll-your-own-elements-ideas/)
 *  Thread Starter [guiguilyon](https://wordpress.org/support/users/guiguilyon/)
 * (@guiguilyon)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/collapse-comment-section/#post-11700576)
 * 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](https://wordpress.org/support/users/guiguilyon/).
 *  Thread Starter [guiguilyon](https://wordpress.org/support/users/guiguilyon/)
 * (@guiguilyon)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/collapse-comment-section/#post-11711427)
 * OK.
 * I got some help on [my themes forum](https://forum.weavertheme.com/forums/topic/collapse-comment-section/)(
   Weaver Xtreme).
    They said I have to go to comments.php of the theme and replace
 * > echo ‘<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](https://wordpress.org/support/topic/plugin-jquery-collapse-o-matic-roll-your-own-elements-ideas/)
 * > <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](https://guigui82.yo.fr/wp/)
 *  Plugin Author [twinpictures](https://wordpress.org/support/users/twinpictures/)
 * (@twinpictures)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/collapse-comment-section/#post-11711465)
 * 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.
 *  Plugin Author [twinpictures](https://wordpress.org/support/users/twinpictures/)
 * (@twinpictures)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/collapse-comment-section/#post-11717967)
 * 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>
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Collapse comment section’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/jquery-collapse-o-matic_fffeff.svg)
 * [Collapse-O-Matic](https://wordpress.org/plugins/jquery-collapse-o-matic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jquery-collapse-o-matic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jquery-collapse-o-matic/)
 * [Active Topics](https://wordpress.org/support/plugin/jquery-collapse-o-matic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jquery-collapse-o-matic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jquery-collapse-o-matic/reviews/)

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [roll-your-own](https://wordpress.org/support/topic-tag/roll-your-own/)

 * 5 replies
 * 2 participants
 * Last reply from: [twinpictures](https://wordpress.org/support/users/twinpictures/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/collapse-comment-section/#post-11717967)
 * Status: resolved