问题wp_list_comments()插入代码

时间:2019-02-07 17:48:39

标签: php jquery html css wordpress

我正在页面上显示评论。我想每2条评论后显示1条广告。

<div class="panel-footer clearfix"></div>,它重复了评论的数量。

我想在每2条评论后添加广告代码。

例如:

<div class="panel-footer clearfix"></div>
<div class="panel-footer clearfix"></div>

/*
 * My ads code
 */

<div class="panel-footer clearfix"></div>
<div class="panel-footer clearfix"></div>

/*
 * My ads code
 */

我的wp_list_comment()函数:

<?php
function sinyor_comment($comment, $args, $depth,$i=0) { 
    $GLOBALS['comment'] = $comment;
    $PostAuthor = false; 

    if($comment->comment_author_email == get_the_author_email()){
        $PostAuthor = true;
    }elseif($comment->comment_author_email == 'mailadresiniz@mail.com'){
        $PostAuthor = true;
    } 
?>

<div class="panel panel-default entry" id="comment-<?php echo $comment->comment_ID; ?>"  itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
    <div class="panel-body">
        <div itemprop="text"> <?php comment_text(); ?> </div>
    </div>
    <div class="panel-footer clearfix">
        /*
         *   My wp comment codes are here
         */
    </div>
</div>

<?php 
}

0 个答案:

没有答案