Changeset 10480 for trunk/wp-admin/edit-form-advanced.php
- Timestamp:
- 02/02/2009 03:41:19 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-form-advanced.php
r10458 r10480 12 12 * @var int 13 13 */ 14 if ( ! isset( $post_ID ) ) 15 $post_ID = 0; 16 else 17 $post_ID = (int) $post_ID; 14 $post_ID = isset($post_ID) ? (int) $post_ID : 0; 18 15 19 16 $action = isset($action) ? $action : ''; … … 438 435 */ 439 436 function post_comment_status_meta_box($post) { 440 global $wpdb, $post_ID;441 437 ?> 442 438 <input name="advanced_view" type="hidden" value="1" /> … … 446 442 </p> 447 443 <?php 444 } 445 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core'); 446 447 /** 448 * Display comments for post. 449 * 450 * @since 2.8.0 451 * 452 * @param object $post 453 */ 454 function post_comment_meta_box($post) { 455 global $wpdb, $post_ID; 456 448 457 $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID)); 449 458 450 if ( !$post_ID || $post_ID < 0 || 1 > $total ) 459 if ( 1 > $total ) { 460 echo '<p>' . __('No comments yet.') . '</p>'; 451 461 return; 452 453 wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); 462 } 463 464 wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); 454 465 ?> 455 466 … … 467 478 <?php 468 479 $hidden = get_hidden_meta_boxes('post'); 469 if ( ! in_array('comments tatusdiv', $hidden) ) { ?>480 if ( ! in_array('commentsdiv', $hidden) ) { ?> 470 481 <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> 471 482 <?php 472 483 } 473 484 } 474 add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core'); 485 if ( 'publish' == $post->post_status || 'private' == $post->post_status ) 486 add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', 'post', 'normal', 'core'); 475 487 476 488 /**
Note: See TracChangeset
for help on using the changeset viewer.