'comment_parent', 'id' => 'comment_ID'); /** * Starts the list before the elements are added. * * @since 2.7.0 * @access public * * @see Walker::start_lvl() * @global int $comment_depth * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of comment. * @param array $args Uses 'style' argument for type of HTML list. */ public function start_lvl( &$output, $depth = 0, $args = array() ) { $GLOBALS['comment_depth'] = $depth + 1; switch ( $args['style'] ) { case 'div': break; case 'ol': $output .= '
    ' . "\n"; break; case 'ul': default: $output .= '
\n"; break; case 'ul': default: $output .= "\n"; break; } } /** * Traverses elements to create list from elements. * * This function is designed to enhance Walker::display_element() to * display children of higher nesting levels than selected inline on * the highest depth level displayed. This prevents them being orphaned * at the end of the comment list. * * Example: max_depth = 2, with 5 levels of nested content. * 1 * 1.1 * 1.1.1 * 1.1.1.1 * 1.1.1.1.1 * 1.1.2 * 1.1.2.1 * 2 * 2.2 * * @since 2.7.0 * @access public * * @see Walker::display_element() * @see wp_list_comments() * * @param object $element Data object. * @param array $children_elements List of elements to continue traversing. * @param int $max_depth Max depth to traverse. * @param int $depth Depth of current element. * @param array $args An array of arguments. * @param string $output Passed by reference. Used to append additional content. */ public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { if ( !$element ) return; $id_field = $this->db_fields['id']; $id = $element->$id_field; parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); /* * If we're at the max depth, and the current element still has children, * loop over those and display them at this level. This is to prevent them * being orphaned to the end of the list. */ if ( $max_depth <= $depth + 1 && isset( $children_elements[$id]) ) { foreach ( $children_elements[ $id ] as $child ) $this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output ); unset( $children_elements[ $id ] ); } } /** * Starts the element output. * * @since 2.7.0 * @access public * * @see Walker::start_el() * @see wp_list_comments() * @global int $comment_depth * @global WP_Comment $comment * * @param string $output Passed by reference. Used to append additional content. * @param object $comment Comment data object. * @param int $depth Depth of comment in reference to parents. * @param array $args An array of arguments. * @param int $id Optional. ID of the current comment. Default 0 (unused). */ public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) { $depth++; $GLOBALS['comment_depth'] = $depth; $GLOBALS['comment'] = $comment; if ( !empty( $args['callback'] ) ) { ob_start(); call_user_func( $args['callback'], $comment, $args, $depth ); $output .= ob_get_clean(); return; } if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) { ob_start(); $this->ping( $comment, $depth, $args ); $output .= ob_get_clean(); } elseif ( 'html5' === $args['format'] ) { ob_start(); $this->html5_comment( $comment, $depth, $args ); $output .= ob_get_clean(); } else { ob_start(); $this->comment( $comment, $depth, $args ); $output .= ob_get_clean(); } } /** * Ends the element output, if needed. * * @since 2.7.0 * @access public * * @see Walker::end_el() * @see wp_list_comments() * * @param string $output Passed by reference. Used to append additional content. * @param WP_Comment $comment The comment object. Default current comment. * @param int $depth Depth of comment. * @param array $args An array of arguments. */ public function end_el( &$output, $comment, $depth = 0, $args = array() ) { if ( !empty( $args['end-callback'] ) ) { ob_start(); call_user_func( $args['end-callback'], $comment, $args, $depth ); $output .= ob_get_clean(); return; } if ( 'div' == $args['style'] ) $output .= "\n"; else $output .= "\n"; } /** * Outputs a pingback comment. * * @since 3.6.0 * @access protected * * @see wp_list_comments() * * @param WP_Comment $comment The comment object. * @param int $depth Depth of comment. * @param array $args An array of arguments. */ protected function ping( $comment, $depth, $args ) { $tag = ( 'div' == $args['style'] ) ? 'div' : 'li'; ?> < id="comment-" >
', '' ); ?>
< has_children ? 'parent' : '', $comment ); ?> id="comment-">
%s says:' ), get_comment_author_link( $comment ) ); ?>
comment_approved ) : ?>
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
', 'after' => '
' ) ) ); ?>
< id="comment-" has_children ? 'parent' : '', $comment ); ?>>
'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
', 'after' => '
' ) ) ); ?>