Поддержка BuddyPress How To Hide Comments From Activity Stream

  • I am interested in “Show/Hide Comments” and I found the following code for that :

    add_action( 'wp_footer', 'add_comment_hide_show' );
    function add_comment_hide_show() {
        .single-group .activity-comments ul{display: none;}
        <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>';
          }, 500);
          $('body').on('click', '.show-comments', function(e) {
    	var obj = $(this).closest('.activity-content').next('.activity-comments').find('ul');
            return false;

    And it is working good when I add it to functions.php but the problem is that by default it shows all the comments and it hides the comments when we click on the “Show/Hide Comments” button. Can anybody edit it so that by default it hides the comments and when we click on the button then it shows the comments.


  • Тема «How To Hide Comments From Activity Stream» закрыта для новых ответов.