Initial commit: TechBlog Pro WordPress theme
Features: - Modern UI with dark mode support - Code highlighting with copy button - Auto table of contents - Reading time & views counter - Responsive design - Admin settings page - AJAX search
This commit is contained in:
Executable
+118
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* Comments Template
|
||||
*
|
||||
* @package TechBlog Pro
|
||||
*/
|
||||
|
||||
if (post_password_required()) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="comments" class="comments-area">
|
||||
|
||||
<?php if (have_comments()) : ?>
|
||||
<h3 class="comments-title">
|
||||
<svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
|
||||
</svg>
|
||||
<?php
|
||||
$comments_number = get_comments_number();
|
||||
printf(
|
||||
esc_html(_n('%d 条评论', '%d 条评论', $comments_number, 'techblog')),
|
||||
$comments_number
|
||||
);
|
||||
?>
|
||||
</h3>
|
||||
|
||||
<ol class="comment-list">
|
||||
<?php
|
||||
wp_list_comments(array(
|
||||
'style' => 'ol',
|
||||
'short_ping' => true,
|
||||
'avatar_size' => 48,
|
||||
'callback' => 'techblog_comment_template',
|
||||
));
|
||||
?>
|
||||
</ol>
|
||||
|
||||
<?php
|
||||
the_comments_navigation(array(
|
||||
'prev_text' => '← 较旧的评论',
|
||||
'next_text' => '较新的评论 →',
|
||||
));
|
||||
?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!comments_open() && get_comments_number() && post_type_supports(get_post_type(), 'comments')) : ?>
|
||||
<p class="no-comments">评论已关闭</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
comment_form(array(
|
||||
'class_form' => 'comment-form',
|
||||
'title_reply' => '',
|
||||
'comment_notes_before' => '',
|
||||
'comment_field' => '
|
||||
<div class="comment-form-group">
|
||||
<label for="comment">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<path d="M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"/>
|
||||
</svg>
|
||||
发表评论
|
||||
</label>
|
||||
<textarea id="comment" name="comment" rows="4" required placeholder="说点什么..."></textarea>
|
||||
</div>',
|
||||
'submit_button' => '<button type="submit" class="submit-btn">
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<line x1="22" y1="2" x2="11" y2="13"/>
|
||||
<polygon points="22 2 15 22 11 13 2 9 22 2"/>
|
||||
</svg>
|
||||
提交评论
|
||||
</button>',
|
||||
));
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Custom Comment Template
|
||||
*/
|
||||
function techblog_comment_template($comment, $args, $depth) {
|
||||
$tag = ('div' === $args['style']) ? 'div' : 'li';
|
||||
?>
|
||||
<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class('comment-item'); ?>>
|
||||
<div class="comment-body">
|
||||
<div class="comment-avatar">
|
||||
<?php echo get_avatar($comment, 48); ?>
|
||||
</div>
|
||||
|
||||
<div class="comment-content">
|
||||
<div class="comment-header">
|
||||
<span class="comment-author">
|
||||
<?php echo get_comment_author_link(); ?>
|
||||
</span>
|
||||
<time datetime="<?php echo get_comment_date('c'); ?>">
|
||||
<?php echo get_comment_date('Y年m月d日'); ?>
|
||||
</time>
|
||||
</div>
|
||||
|
||||
<div class="comment-text">
|
||||
<?php comment_text(); ?>
|
||||
</div>
|
||||
|
||||
<div class="comment-actions">
|
||||
<?php
|
||||
comment_reply_link(array_merge($args, array(
|
||||
'depth' => $depth,
|
||||
'max_depth' => $args['max_depth'],
|
||||
)));
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user