Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




separate_comments [ WordPress Function ]

separate_comments ( $comments )
Parameters:
  • (array) $comments Array of comments
Returns:
Defined at:



Separates an array of comments into an array keyed by comment_type.

Source


<?php
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;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics