【问题标题】:How can I add reply to comments in Wordpress如何在 Wordpress 中添加对评论的回复
【发布时间】:2013-09-16 23:52:42
【问题描述】:

我有以下代码用于获取 cmets 并呈现评论表单。但我没有看到对评论的任何回复。我已经搜索了网络,但我仍然无法弄清楚要使用什么功能以及在哪里使用它。

这是渲染表单的代码:

$comments_args = array(
    'fields' =>  $fields,
    'comment_field' => "<div class=\"comment-component\"><textarea name=\"comment\" id=\"comment\" ></textarea></div>",
    'comment_notes_after' => '',
    'title_reply' => 'Comment on this post!',
    'title_reply_to' => 'Reply to this comment',
    'label_submit' => 'Comment',
    'comment_notes_before' => "<p class='simple-title'>" . 'We will not publish you email' . ' '
);

comment_form($comments_args);

这是渲染所有 cmets 和相关数据的函数:

function behdis_comment($comment_storage, $arguments = array('author' => true, 'date' => true,'id' => true,
'content' => true,'thumb' => true, 'class_name_main' => 'post-each-comment', 'class_name_meta' => 'post-each-comment-meta'))
{



    /** First we have to check for the argument. **/    

    // bc = behdisComment
    $bc_author = $arguments['author'];
    $bc_date = $arguments['author'];
    $bc_id = $arguments['author'];
    $bc_content = $arguments['author'];
    $bc_thumb = $arguments['author'];
    $bc_container_class = $arguments['class_name_main'];
    $bc_meta_class = $arguments['class_name_meta'];         

    // cont = container
    // main wrapper for each induvidual comment
    $cont_main_opening = "<div class=\"$bc_container_class\">";
    $div_closing = "</div>";
    // end of main wrapper

    // main wrapper for each induvidual comment
    $cont_main_opening = "<div class=\"$bc_container_class\">";
    // end of main wrapper

    $cont_meta_opening = "<div class=\"$bc_meta_class\">";

    foreach($comment_storage as $comment_each)
    {
        echo $cont_main_opening;

                    /** Author **/ 
                    if($bc_author===true){echo $cont_meta_opening;}

                            if($bc_author===true){echo $comment_each->comment_author;}
                            echo ' ';
                            if($bc_date===true){echo get_the_time('j F, Y');}

                    if($bc_date===true){echo $div_closing;}
                    /** Author **/ 

       echo $comment_each->comment_content; 

        echo $div_closing;
    }           
}

【问题讨论】:

    标签: php html css wordpress content-management-system


    【解决方案1】:

    看起来'date'、'id'、'content'和'thumb'都设置为$arguments['author'];

    这是笔误吗?

    如果不是,这可能是您的问题。

    【讨论】:

      猜你喜欢
      • 2017-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-28
      • 2014-09-06
      • 2014-07-06
      • 2016-12-28
      相关资源
      最近更新 更多