使用PHP有条件地隐藏或禁用WordPress评论框

我只允许用户在帖子中发表一条评论。

我使用preprocess_comment过滤器挂钩检查/验证我的用户评论。并停止发表多条评论。

但是我无法在用户发表评论后隐藏评论表单框。当用户在帖子中发表评论时, 评论框将从页面中禁用/隐藏。

请帮助


#1


你也可以在主题中创建课程注释表单的自定义comment.php模板。检查此链接https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/comment-template/

页面末尾:https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/comment-template/#the-end

<?php
    if( YOUR_CONDITION_FUNCTION_OR_LOGIC() ){
        comment_form();
    }
?>

希望对你有帮助。

来源:

https://www.srcmini02.com/64352.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37467.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?