Skip to content

Instantly share code, notes, and snippets.

@Demontager
Created December 13, 2015 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Demontager/bc7c967af7f59f12076a to your computer and use it in GitHub Desktop.
Save Demontager/bc7c967af7f59f12076a to your computer and use it in GitHub Desktop.
<h2>Комментарии</h2>
<?php
if ( have_comments() ) : ?>
<p><?php comments_number('Нет комментариев', '1 комментарий', '% комментариев' );?></p>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link() ?></div>
<div class="alignright"><?php next_comments_link() ?></div>
</div>
<div class="commentlist">
<?php
$args = array(
'style' => 'div',
'callback' => 'comment_tmp',
'reverse_top_level' => true,
);
wp_list_comments($args);
?>
</div>
<div class="navigation">
<div class="alignleft"><?php previous_comments_link() ?></div>
<div class="alignright"><?php next_comments_link() ?></div>
</div>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ( comments_open() ) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments"><?php _e('Comments are closed.'); ?></p>
<?php endif; ?>
<?php endif; ?>
<?php if ( comments_open() ) : ?>
<div id="respond">
<h3><?php comment_form_title( __('Leave a Reply'), __('Leave a Reply to %s' ) ); ?></h3>
<div id="cancel-comment-reply">
<small><?php cancel_comment_reply_link() ?></small>
</div>
<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url( get_permalink() )); ?></p>
<?php else : ?>
<form action="<?php echo site_url(); ?>/wp-comments-post.php" method="post" id="commentform">
<?php if ( is_user_logged_in() ) : ?>
<p><?php printf(__('Logged in as <a href="%1$s">%2$s</a>.'), get_edit_user_link(), $user_identity); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php esc_attr_e('Log out of this account'); ?>"><?php _e('Log out &raquo;'); ?></a></p>
<?php else : ?>
<?php
$placeholder_author = 'Имя (обязательно)';
$placeholder_email = 'E-mail (не обязательно)';
?>
<p>
<input type="text" name="author" class="inputForm" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" placeholder="<?=$placeholder_author?>" <?php if ($req) echo "aria-required='true'"; ?> />
<?php /*<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label>*/?>
<input type="text" name="email" class="inputForm" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" placeholder="<?=$placeholder_email?>" <?php if ($req) echo "aria-required='true'"; ?> />
<?php /*<label for="email"><small><?php _e('Mail (will not be published)'); ?> <?php if ($req) _e('(required)'); ?></small></label>*/?>
</p>
<?php endif; ?>
<!--<p><small><?php printf(__('<strong>XHTML:</strong> You can use these tags: <code>%s</code>'), allowed_tags()); ?></small></p>-->
<p><textarea name="comment" id="comment" rows="10" tabindex="4"></textarea></p>
<p><input name="submit" type="submit" class="submitForm" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
<?php comment_id_fields(); ?>
</p>
<?php do_action('comment_form', $post->ID); ?>
</form>
<?php endif; // If registration required and not logged in ?>
</div>
<?php endif; // if you delete this the sky will fall on your head ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment