wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
separate_comments › WordPress Function
Depuis2.7.0
Dépréciéen/a
› separate_comments ( $comments )
Paramètres: |
|
Retourne: |
|
Défini(e) dans: |
|
Codex: |
Separates an array of comments into an array keyed by comment_type.
Fonctions en relation: get_comments, have_comments, wp_update_comment, the_comment, wp_insert_comment
Source
function separate_comments( &$comments ) { $comments_by_type = array( 'comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array(), ); $count = count( $comments ); for ( $i = 0; $i < $count; $i++ ) { $type = $comments[ $i ]->comment_type; if ( empty( $type ) ) { $type = 'comment'; } $comments_by_type[ $type ][] = &$comments[ $i ]; if ( 'trackback' === $type || 'pingback' === $type ) { $comments_by_type['pings'][] = &$comments[ $i ]; } } return $comments_by_type; }