Guest User

Comments.php

a guest
Dec 19th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. <div id="comments">
  2.  
  3. <?php
  4. //---------------------------------------------------------------------
  5. // Evita que carguen directamente este archivo comments.php
  6. //---------------------------------------------------------------------
  7. if (!empty($_SERVER['SCRIPT-FILENAME']) && basename($_SERVER['SCRIPT-FILENAME']) == 'comments.php') {
  8. die(__('You cannot access to this page.', 'amk'));
  9. }
  10.  
  11. //---------------------------------------------------------------------
  12. // Si el artículo está protegido muestra un texto
  13. //---------------------------------------------------------------------
  14. if (post_password_required()) : ?>
  15. <p><?php _e( 'This article is password protected', 'amk'); ?></p>
  16. </div>
  17. <?php return; ?>
  18. <?php endif;
  19.  
  20. //---------------------------------------------------------------------
  21. // Si es que hay comentarios, se muestran
  22. //---------------------------------------------------------------------
  23. if (have_comments()) : ?>
  24.  
  25. <?php //Muestra un titulo para los comentarios, hay 3 opciones: cuando no hay, cuando hay un solo comentario y cuando hay 2 o más ?>
  26. <h3><?php comments_number(__('Comment. be the first one:', 'amk'), __('There is only 1 comment. i know you want to say something:', 'amk'), __('% comments. <a href="#comment_box">Add a Comment:</a>', 'amk')); ?></h3>
  27.  
  28.  
  29. <ol id="comments-list">
  30. <?php wp_list_comments(); //Muestra el listado de comentarios y define el tamaño del avatar ?>
  31. </ol>
  32.  
  33. <?php //Si es que los comentarios están paginados, muestra links para comentarios antiguos y recientes
  34. if (get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
  35.  
  36. <ul class="pager">
  37.  
  38. <li class="previous">&larr; <?php previous_comments_link(__( 'Previous comments', 'amk')); ?></li>
  39. <li class="next"><?php next_comments_link(__( 'Recent comments', 'amk')); ?> &rarr;</li>
  40.  
  41. </ul> <!-- end .pager -->
  42.  
  43. <?php endif; ?>
  44.  
  45. <?php
  46. //---------------------------------------------------------------------
  47. // Si no hay comentarios y los comentarios están cerrados muestra un texto
  48. //---------------------------------------------------------------------
  49. elseif (!comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) : ?>
  50.  
  51. <p><?php _e( 'Comments are not allowed in this article', 'amk');?></p>
  52. </div>
  53. <?php return; ?>
  54. <div id="comment_box">
  55. <?php endif;
  56.  
  57. //---------------------------------------------------------------------
  58. // Muestra el formulario de comentarios
  59. //---------------------------------------------------------------------
  60.  
  61. comment_form();
  62.  
  63. ?>
  64. </div>
  65. </div><!-- end #comments-area -->
Advertisement
Add Comment
Please, Sign In to add comment