comments.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Theme_Compat
  5. * @deprecated 3.0.0
  6. *
  7. * This file is here for backward compatibility with old themes and will be removed in a future version
  8. */
  9. _deprecated_file(
  10. /* translators: %s: Template name. */
  11. sprintf( __( 'Theme without %s' ), basename( __FILE__ ) ),
  12. '3.0.0',
  13. null,
  14. /* translators: %s: Template name. */
  15. sprintf( __( 'Please include a %s template in your theme.' ), basename( __FILE__ ) )
  16. );
  17. // Do not delete these lines.
  18. if ( ! empty( $_SERVER['SCRIPT_FILENAME'] ) && 'comments.php' === basename( $_SERVER['SCRIPT_FILENAME'] ) ) {
  19. die( 'Please do not load this page directly. Thanks!' );
  20. }
  21. if ( post_password_required() ) { ?>
  22. <p class="nocomments"><?php _e( 'This post is password protected. Enter the password to view comments.' ); ?></p>
  23. <?php
  24. return;
  25. }
  26. ?>
  27. <!-- You can start editing here. -->
  28. <?php if ( have_comments() ) : ?>
  29. <h3 id="comments">
  30. <?php
  31. if ( 1 == get_comments_number() ) {
  32. printf(
  33. /* translators: %s: Post title. */
  34. __( 'One response to %s' ),
  35. '&#8220;' . get_the_title() . '&#8221;'
  36. );
  37. } else {
  38. printf(
  39. /* translators: 1: Number of comments, 2: Post title. */
  40. _n( '%1$s response to %2$s', '%1$s responses to %2$s', get_comments_number() ),
  41. number_format_i18n( get_comments_number() ),
  42. '&#8220;' . get_the_title() . '&#8221;'
  43. );
  44. }
  45. ?>
  46. </h3>
  47. <div class="navigation">
  48. <div class="alignleft"><?php previous_comments_link(); ?></div>
  49. <div class="alignright"><?php next_comments_link(); ?></div>
  50. </div>
  51. <ol class="commentlist">
  52. <?php wp_list_comments(); ?>
  53. </ol>
  54. <div class="navigation">
  55. <div class="alignleft"><?php previous_comments_link(); ?></div>
  56. <div class="alignright"><?php next_comments_link(); ?></div>
  57. </div>
  58. <?php else : // This is displayed if there are no comments so far. ?>
  59. <?php if ( comments_open() ) : ?>
  60. <!-- If comments are open, but there are no comments. -->
  61. <?php else : // Comments are closed. ?>
  62. <!-- If comments are closed. -->
  63. <p class="nocomments"><?php _e( 'Comments are closed.' ); ?></p>
  64. <?php endif; ?>
  65. <?php endif; ?>
  66. <?php comment_form(); ?>