Skip to content

Instantly share code, notes, and snippets.

@leocristofani
Created April 10, 2013 00:37
Show Gist options
  • Save leocristofani/5350724 to your computer and use it in GitHub Desktop.
Save leocristofani/5350724 to your computer and use it in GitHub Desktop.
<?php
// Prevent the direct loading of the file
// ========================================
if(!empty($_SERVER['SCRIPT-FILENAME']) && basename($_SERVER['SCRIPT-FILENAME']) == 'comments.php')
{
die('You cannot access this file directly');
}
?>
<!-- Check if post is pwd protected
========================================== -->
<?php if(post_password_required()) : ?>
<p>This post is password protected. Enter the password to view the comments.</p>
<?php return; ?>
<?php endif; ?>
<!-- -->
<?php if(have_comments()) : ?>
<a href="#respond" class="article-add-comments">+</a>
<h3><?php comments_number('No comments','One comment',' % comments'); ?></h3>
<ol class="commentslist"><!-- TODO: implementar a função adaptive_comments em functions.php -->
<?php wp_list_comments('callback=adaptive_comments'); ?>
</ol>
<?php if(get_comment_pages_count() > 1 && get_option('page_comments')) : ?>
<!-- comments navigation -->
<div class="comments-nav-section">
<p class="fl"><?php previous_comments_link('&larr; Older Comments'); ?></p>
<p class="fr"><?php next_comments_link('Newer Comments &rarr;'); ?></p>
</div>
<?php endif; ?>
<?php elseif(!comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments') : ?>
<p>Comments are closed.</p>
<?php endif; ?>
<?php comment_form(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment