Make WordPress Core


Ignore:
Timestamp:
10/17/2008 09:44:22 AM (17 years ago)
Author:
azaozz
Message:

Comments post-box: show comments on the currently edited post with ajax, 20 at a time

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-form-advanced.php

    r9221 r9225  
    342342<?php
    343343
    344     if ( !$post_ID || $post_ID < 0 )
     344    if ( !$post_ID || $post_ID < 0 || 0 == $post->comment_count )
    345345        return;
    346346
    347     if ( !$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $post_ID) ) )
    348         return;
    349 
    350     // Make sure comments, post, and post_author are cached
    351 //  update_comment_cache($comments);
    352 ?>
    353 
    354 <table class="widefat">
     347wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
     348?>
     349
     350<table class="widefat comments-box" style="display:none;">
    355351<thead>
    356352    <tr>
     
    361357</thead>
    362358<tbody id="the-comment-list" class="list:comment">
    363 <?php
    364     foreach ($comments as $comment)
    365         _wp_comment_row( $comment, 'single', false, false );
    366 ?>
    367359</tbody>
    368360</table>
    369 
     361<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get();return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>
    370362<?php
    371363}
Note: See TracChangeset for help on using the changeset viewer.