447 | | <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow comments.' ) ?></label><br /> |
| 447 | <label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php |
| 448 | |
| 449 | $checked = false; |
| 450 | if ( $post->comment_status === 'open' ) |
| 451 | $checked = true; |
| 452 | |
| 453 | if ( get_option( 'close_comments_for_old_posts', false ) ) { |
| 454 | $last_allowed_time = current_time( 'timestamp', 1 ) - ( absint( get_option( 'close_comments_days_old', 0 ) ) * 24 * 60 * 60 ); // now - days in seconds |
| 455 | $post_timestamp = mysql2date( 'U', $post->post_date_gmt, false ); |
| 456 | if ( $post_timestamp < $last_allowed_time ) { |
| 457 | $checked = false; |
| 458 | echo 'disabled="disabled" '; |
| 459 | } |
| 460 | } |
| 461 | if ( $checked ) |
| 462 | echo 'checked="checked"'; |
| 463 | ?> /> <?php _e( 'Allow comments.' ) ?></label><br /> |