Support » Plugin: Collapse-O-Matic » Collapse comment section

  • Resolved guiguilyon

    (@guiguilyon)


    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

    (@twinpictures)

    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/

    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 1 year, 2 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 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

    <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

    Plugin Author twinpictures

    (@twinpictures)

    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

    (@twinpictures)

    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.