2012-06-12 72 views
1

我一直在关注此tutorial,我无法设法让我的回复按照预期的方式与wp_enqueue_script('comment-reply'); php函数一起工作。Wordpress wp_enqueue_script('comment-reply')为自定义主题

我已经删除代码我认为这是无关紧要的东西我想完成的任务。

的预期输出(从二十一摘自1.3 减样式表

Expected output http://iforce.co.nz/i/n3cvsots.tjn.png

实际输出(从我的主题两者减样式表

Actual output http://iforce.co.nz/i/w3x4u4q0.3w4.png

如何根据此tutorial的高级评论完成预期输出?我应该怎么做我的functions.php和single.php来完成它?

回答

1

解决方案其实很简单...在阅读javascript的wordpress代码之后。我发现问题在于每个注释块的创建方式。

基于关在function.php此功能

//this function will be called in the next section 
function advanced_comment($comment, $args, $depth) { 
$GLOBALS['comment'] = $comment; 
$PostAuthor = false; 
if($comment->comment_author_email == get_the_author_email()) { 
$PostAuthor = true;} 
elseif($comment->comment_author_email == '[email protected]') { 
$PostAuthor = true;} ?> 
<li <?php if($PostAuthor) {echo "class='authorcomment' ";} ?> 
<?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> 
<div class="comment-author vcard"> 
<?php echo get_avatar($comment, $size='48',$default='<path_to_url>'); ?> 
<div class="comment-meta"<a href="<?php the_author_meta('user_url'); ?>"><?php printf(__('%s'), get_comment_author_link()) ?></a></div> 
<small><?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),' ','') ?></small> 
</div> 
<?php if ($comment->comment_approved == '0') : ?> 
<div id="moderation"><?php _e('Your comment is awaiting moderation.') ?></div> 
      <?php endif; ?><br /> 
     <div class="comment-text"> 
      <?php comment_text() ?> 
     </div> 
      <div class="reply"> 
      <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])), $comment->comment_ID) ?> 
      <?php delete_comment_link(get_comment_ID()); ?> 
      </div> 
    <div class="clear"></div> 
     <?php } ?> 

我发现误差与

<?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> 

通过简单的ID删除“俪”,所以它形成的id =“的评论 - “

回复表单现在回复。

+0

这就是:通过简单地删除id中的“li-”,以便它形成id =“comment-” – Banago