Post 评论使用 post ids Wordpress

Post comments using post ids Wordpress

我正在尝试使用具有两种不同设计的博客(posts) 首先,对于从网站访问博客的非登录(访客)用户(示例 URL – Click Here) 其次是用于从前端仪表板访问博客的登录用户

对于第一种情况,我使用 single.php 和 对于第二种情况,我在用户的仪表板中使用自定义模板并使用 post ids.

获取 posts

查询 ——————–

所以问题是如何使用 post id post 对 post 发表评论,即第二种情况? 例如 post url 是:http://yourdomain.com/blogs/?pid=23

这是突出显示查询的附加视频 无法显示内容。需要 Adob​​e Flash。

此外,有没有其他方法可以实现上述场景,即两种不同的设计

如果需要更多说明,请告诉我。

您可以在登录用户的自定义查询中使用正常循环

例如

<?php
$args = array(

    'post__in' => array(1,2,4,6),
    'post_type'  => 'post',

);
// the query
$the_query = new WP_Query( $args ); ?>

    <!-- the loop -->
    <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

      // put your code here
    <?php endwhile; ?>

    <!-- end of the loop -->
    <?php wp_reset_postdata(); ?>

这样你就不用担心通过 post id 获取评论(循环将为你处理 id)