• How do i make a toggle function in a nested comments, I mean all nest comments are hide by default which can be only display by clicking “show comments”

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    It’s really theme dependent, but most themes use wp_list_comments() to display comments. If your theme does so, all comments are contained in <ol> elements. All replies to comments have the class “children”, so to hide nested comments by default, use this CSS:

    ol.children {
      display: none;
    }

    Add a click event listener to the toggle button. The callback on a click event would toggle between display: block; and display: none; style properties.

Viewing 1 replies (of 1 total)
  • The topic ‘Toggle nested/threaded comments’ is closed to new replies.