Activity

  • Kamil started the question Hide and Show Comments on Wall and in Newsfeed in the forum BuddyBoss Wall 8 years ago

    Hallo,

    I have a problem with hidding comments in the activity stream.
    I found a code to hide and show the comments and it works but if i use the code the like count is gone.

    This is the code i use:
    add_action( 'wp_footer', 'add_comment_hide_show' );
    function add_comment_hide_show() {
    ?>
    <style>
    .activity-comments ul{display: none;}
    </style>
    <script type="text/javascript">
    jQuery(function($) {
    setInterval(function() {
    $('.activity-meta').each(function() {
    if( !$(this).find('.show-comments').length ){
    var html = '<a href="#" class="button bp-primary-action show-comments">Show/Hide Comments</a>';
    $(this).find('.button.acomment-reply').after(html);
    }
    });

    }, 500);

    $('body').on('click', '.show-comments', function(e) {
    e.preventDefault();
    var obj = $(this).closest('.activity-content').next('.activity-comments').find('ul');
    obj.slideToggle();
    return false;
    });

    });
    </script>
    <?php
    }

    Is there another way to hide and show comments?

    Or how can i show the like count ?

    Sincerely,
    Max