Tagged: , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1035582

    Hi,

    I would like to show the comments of a post only when the user is clicking on a button or show/hide link.

    Since the show-hide-comments plugin is no longer available, I found this manual solution:

    How can I get the javascript function into an ENFOLD function (I’m not a coder),
    and without a linked file to Google (-> not GDPR conform in Germany)?

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    
    $(document).ready(function(){
    
    $(".slidingDiv").hide();
    $(".show_hide").show();
    
    $('.show_hide').click(function(){
    $(".slidingDiv").slideToggle();
    });
    
    });
    
    </script>

    and where exactly in the comments.php do I have to insert this part:

    <a href="#" class="show_hide">Show/hide</a>
    <div class="slidingDiv">
    Fill this space with really interesting content. <a href="#" class="show_hide">hide</a></div>

    I guess, the “slidingDiv” class can be replaced by “comment_container” class???

    Here is an example of what I mean:

    View post on imgur.com

    live view: https://mymonk.de/gleichmuetig/

    Thanks for helping me out!

    #1035604

    Hey Gitte,

    To toggle a section when a button is clicked please check https://kriesi.at/documentation/enfold/button/#toggle-id-7

    Just add your comments inside a color section.

    In case, if you are using a sidebar on the blog page, just add your comments inside a column which suits your design.

    Best regards,
    Vinay

    #1035605

    I do not use the ALB for posts.

    #1035611

    Hi,

    In that case please inspect the class name for the div which you want to toggle and replace it in the js code :)

    For example:

    Replace the class and ID in the below line with the class name of the div with comments. Same with CSS.

    jQuery(“#toggle-section”).toggleClass(“hide-me”);

    Or you can give this plugin a shot https://wordpress.org/plugins/show-all-comments-in-one-page/

    Or check out this tutorial https://premium.wpmudev.org/forums/topic/showhide-comments-section-with-jquery

    Best regards,
    Vinay

    #1035614

    Please refer to my first post:
    Your suggested plugin is not what I’d like to achieve.
    And I already have a tutorial and code snippets – see above, but not sure,

    – how to put it into an ENFOLD “function” and
    – where to place the HTML part exactly in the comments.php

    #1037548

    Hi,

    To add your custom js code to wordpress please install a child theme and use the format in the below link

    To avoid js conflict replace the “$” sign with the word “jQuery” in the custom code.

    By default, the jQuery script will be included in your WP installation so you can simply remove the linked file to google.

    Best regards,
    Vinay

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.