【问题标题】:Filter wordpress comments by approved按批准过滤 wordpress 评论
【发布时间】:2016-06-28 00:17:43
【问题描述】:

我用它来为我的自定义主题获取 wordpress cmets:

get_comments( array('status' => 'aprove','order' => 'ASC', 'post_id' => $newpost->ID) );

除了等待审核的 cmets 没有被过滤之外,一切正常。 遵循法典:http://codex.wordpress.org/Function_Reference/get_comment'status' => 'approve' 应该过滤掉那些,但这似乎没有发生。

我没有用对吗?

【问题讨论】:

    标签: php wordpress comments wordpress-theming


    【解决方案1】:

    试试approve 两个P!

    get_comments( array('status' => 'approve','order' => 'ASC', 'post_id' => $newpost->ID) );
    

    这里是the docs page for get_comments(您链接到get_comment 单数。)

    【讨论】:

    • 这发生在我们最好的人身上!
    【解决方案2】:

    它对我有用。您可以使用以下代码在段落中显示您批准的 cmets。

    <?php foreach (get_comments(array('status' => 'approve','order' => 'ASC', 'post_id' => $newpost->ID)) as $comment): ?>
    <div class="comment-show"><h4><?php echo $comment->comment_author; ?> said: </h4> <p>"<?php echo $comment->comment_content; ?>"</p></div>
    <?php endforeach; ?>
    

    我在以下网站中使用过展示 cmets http://rumpa07cse.com/how-to-index-your-website-and-blog-very-quick/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-03
      • 1970-01-01
      • 2012-02-04
      • 1970-01-01
      • 2011-11-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多