Skip to content

Instantly share code, notes, and snippets.

@hitsujixgit
Created June 19, 2014 10:36
Show Gist options
  • Save hitsujixgit/059430e8c4b7d7703b7e to your computer and use it in GitHub Desktop.
Save hitsujixgit/059430e8c4b7d7703b7e to your computer and use it in GitHub Desktop.
コメントフォームをカスタマイズする - index.phpをカスタマイズする#7
<?php
function mytheme_comments($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>" class="comment-wrapper">
<div class="comment-meta">
<?php echo get_avatar( $comment, $args['avatar_size']) ?>
<ul class="comment-meta-list">
<li class="comment-author-name">
<?php printf('<cite class="fn">%s</cite>', get_comment_author_link()) ?>
</li>
<li class="comment-title">
<?php
$commentID_parent = $comment->comment_parent;
if( $commentID_parent != 0 ):
?>
<a href="<?php echo htmlspecialchars( get_comment_link( $commentID_parent ) ) ?>"><?php echo get_comment_author($commentID_parent); ?>さんへの返信</a>
<?php else: ?>
<a href="#top">「<?php the_title(); ?>」へのコメント</a>
<?php endif; ?>
<?php
if ($comment->comment_approved == '0') {
echo '<span class="comment-approval">このコメントは承認待ちです。</span>';
}
?>
</li>
<li class="comment-date">
<a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
<?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?></a>
<span><?php edit_comment_link('(編集する)','','') ?></span>
</li>
</ul>
</div><!-- comment-meta -->
<div class="comment-content">
<?php comment_text() ?>
</div>
<div class="comment-reply">
<?php comment_reply_link(array_merge( $args, array(
'reply_text'=>'返信する',
'add_below' =>$add_below,
'depth' =>$depth,
'max_depth' =>$args['max_depth']))) ?>
</div>
</div><!-- comment-comment_ID -->
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment