WordPress.org

Ready to get started?Download WordPress

Forums

How do I get the right order of the nested comments? (1 post)

  1. morpe
    Member
    Posted 1 year ago #

    array (size=10)
      'comment 0' =>
        array (size=2)
          'comment_id' => string '22' (length=2)
          'parent_of' => string '0' (length=1)
      'comment 1' =>
        array (size=2)
          'comment_id' => string '23' (length=2)
          'parent_of' => string '0' (length=1)
      'comment 2' =>
        array (size=2)
          'comment_id' => string '24' (length=2)
          'parent_of' => string '0' (length=1)
      'comment 3' =>
        array (size=2)
          'comment_id' => string '25' (length=2)
          'parent_of' => string '0' (length=1)
      'comment 4' =>
        array (size=2)
          'comment_id' => string '26' (length=2)
          'parent_of' => string '24' (length=2)
      'comment 5' =>
        array (size=2)
          'comment_id' => string '27' (length=2)
          'parent_of' => string '22' (length=2)
      'comment 6' =>
        array (size=2)
          'comment_id' => string '28' (length=2)
          'parent_of' => string '0' (length=1)
      'comment 7' =>
        array (size=2)
          'comment_id' => string '29' (length=2)
          'parent_of' => string '25' (length=2)
      'comment 8' =>
        array (size=2)
          'comment_id' => string '30' (length=2)
          'parent_of' => string '29' (length=2)
      'comment 9' =>
        array (size=2)
          'comment_id' => string '31' (length=2)
          'parent_of' => string '27' (length=2)

    this is a var_dump of comment_ID and comment_parent.

    order output:
    22, 23, 24, 25, 26, 27, 28, 29, 30, 31

    right order
    22 -> 27 -> 31, 23, 24 -> 26, 25 -> 29 -> 30, 28

    [No bumping. If it's that urgent, consider hiring someone.]

Topic Closed

This topic has been closed to new replies.

About this Topic