Ticket #1649: 1649.patch
File 1649.patch, 3.6 KB (added by , 8 years ago) |
---|
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/comments.php
42 42 if ( is_singular( 'post' ) ) { 43 43 wp_list_comments(); 44 44 } else { 45 wp _list_comments( array( 'callback' => 'wporg_developer_user_note' ));45 wporg_developer_list_user_notes(); 46 46 } 47 47 ?> 48 48 </ol><!-- .comment-list --> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php
72 72 } 73 73 endif; 74 74 75 if ( ! function_exists( 'wporg_developer_list_user_notes' ) ) : 76 /** 77 * List user contibuted notes 78 * 79 * @param integer $post_id Optional. Post id to list comments for 80 */ 81 function wporg_developer_list_user_notes( $post_id = 0 ) { 82 83 $post_id = absint( $post_id ); 84 85 if ( ! $post_id ) { 86 $post_id = get_the_ID(); 87 } 88 89 $comments = get_comments ( array( 'post__in' => array( $post_id ) ) ); 90 $order = array(); 91 92 if ( empty( $comments ) ) { 93 return; 94 } 95 96 foreach ( $comments as $key => $comment ) { 97 $order[ $key ] = (int) DevHub_User_Contributed_Notes_Voting::count_votes( $comment->comment_ID, 'difference' ); 98 } 99 100 // sort the posts by votes 101 array_multisort( $order, SORT_DESC, $comments ); 102 103 foreach ( $comments as $key => $comment ) { 104 wporg_developer_user_note( $comment ); 105 } 106 } 107 endif; 108 75 109 if ( ! function_exists( 'wporg_developer_user_note' ) ) : 76 110 /** 77 111 * Template for user contributed notes. 78 *79 * Used as a callback by wp_list_comments() for displaying the notes.80 112 */ 81 function wporg_developer_user_note( $comment , $args, $depth) {113 function wporg_developer_user_note( $comment ) { 82 114 $GLOBALS['comment'] = $comment; 83 115 84 116 if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?> … … 90 122 91 123 <?php else : ?> 92 124 93 <li id="comment-<?php comment_ID(); ?>" <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent'); ?>>125 <li id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>> 94 126 <article id="div-comment-<?php comment_ID(); ?>" class="comment-body"> 95 127 <div class="comment-content"> 96 128 <?php comment_text(); ?> … … 101 133 <?php DevHub_User_Contributed_Notes_Voting::show_voting(); ?> 102 134 <div class="comment-author vcard"> 103 135 <span class="comment-author-attribution"> 104 <?php if ( 0 != $args['avatar_size'] ) { 105 echo get_avatar( $comment, $args['avatar_size'] ); 106 } ?> 136 <?php echo get_avatar( $comment, 32 ); ?> 107 137 108 138 <?php 109 139 // This would all be moot if core passed the $comment context for 'get_comment_author_link' filter … … 135 165 </footer> 136 166 <!-- .comment-meta --> 137 167 138 <?php139 comment_reply_link( array_merge( $args, array(140 'add_below' => 'div-comment',141 'depth' => $depth,142 'max_depth' => $args['max_depth'],143 'before' => '<div class="reply">',144 'after' => '</div>',145 ) ) );146 ?>147 168 </article><!-- .comment-body --> 148 169 149 170 <?php