自定义Wordpress循环注释字段

时间:2020-04-11 02:53:55

标签: php wordpress

因此,我有一个现有网站,因此决定通过博客/常见问题解答部分进行更新。您可以在此处查看链接:

https://lawnbagsigns.com/faq.php

我的想法是我想将WordPress尽可能多地集成到我现有的网站设计中。所以我做了一页,写了自己的wordpress循环和逻辑。

我要使用的所有功能,除了个别帖子的评论。

您可以使用评论表单并发表评论,但是它将带您到我将wordpress安装到的实际位置:

https://lawnbagsigns.com/faq-blog/wordpress/floor-vinyl-stickers-for-social-distancing-hash-tags-in-elevators-lobbies-corridors-etc/

我要执行的操作是重定向到同一页面(包含所有GET信息,以便我可以显示适当的消息)。

这是部分


   //Get only the approved comments
   $args = array(
       'p' => $_GET['postID'],
       'status' => 'approve'
   );

   // The comment Query
   $comments_query = new WP_Comment_Query;
   $comments = $comments_query->query( $args );

   // Comment Loop
   if ( $comments ) {
    foreach ( $comments as $comment ) {
    echo '<p>' . $comment->comment_content . '</p>';
    }
   } else {
    echo 'No comments found.';
   }

   }


   $args = array(
       'must_log_in' => false,
       'redirect_to' => "https://lawnbagsigns.com/faq.php"
   );
   comment_form($args, $_GET['postID'] );
   //echo '<input type="hidden" name="redirect_to" value="https://www.lawnbagsigns.com"> ';
   ```

The commented echo is my attempt to override the post input that's generated as part of the comment_form. 
As far as I'm aware, the 'redirect_to' argument is what wp-comments-post.php uses to redirect the user after the comment has been submitted, but it doesn't seem like the comment form function takes it as valid. I've looked up the wordpress codex for some documentation, but so far I'm unable to find a quick and simple solution. Any help? 

0 个答案:

没有答案
相关问题