我一直在從頭開發一個自定義WordPress主題,並遇到了我的comments.php文件的一個小問題。WP評論沒有發佈正確
https://gist.github.com/phillipdews/dcebfec2016a93bd0169
我覺得從這個文件的第44行的問題,莖,當我試圖通過去發表在我的博客文章是否登陸,或者不在註釋流程:
www.mydomain.com/postlink/wp-comments-post.php
當自然也需要到:
www.mydomain.com/wp-comments-post.php
UPDATE
這就是我決定要做的!我又從頭開始,已經編寫了我的comments.php文件是這樣的:
<div id="comments">
<?php if (post_password_required()) : ?>
<p>This post is password protected. Enter the password to view and comments</p>
</div>
<?php
return;
endif;
?>
<?php if (have_comments()) : ?>
<ol>
<?php wp_list_comments (array('callback' => 'BRUM_Theme_comment')); ?>
</ol>
<?php
elseif (! comments_open() && ! is_page() && post_type_supports(get_post_type(), 'comments')) :
?>
<p>Comments are closed</p>
<?php endif; ?>
<?php comment_form(); ?>
</div>
我加入這個代碼片段到我的functions.php文件!這到目前爲止,我的評論顯示,人們也可以留言在我的博客文章!但到目前爲止,'回覆'按鈕不是正在渲染。
<?php
function BRUM_Theme_comment($comment, $args, $depth){
$GLOBALS['comment'] = $comment;
?>
<?php if ($comment->comment_approved == '1'): ?>
<li>
<article id="comment-<?php comment_ID() ?>">
<?php echo get_avatar($comment); ?>
<h4>
<?php comment_author_link() ?>
</h4>
<time><a href="#comment-<?php comment_ID() ?>" pubdate><?php comment_date() ?> at <?php comment_time() ?></a></time>
<?php comment_text() ?>
</article>
<?php endif;
}
就是這樣到目前爲止!一旦我得到了答覆按鈕的工作,我會修改代碼!
嗨菲利普,如果您發現問題的解決方案隨時發佈您的解決方案作爲答案,然後接受它。 – themerlinproject