我如何隐藏WordPress的评论表格? [英] How do I hide the WordPress comments form?

查看:172
本文介绍了我如何隐藏WordPress的评论表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个插件,使Facebook能够评论WordPress。用户已请求一个功能,将在启用Facebook评论的帖子上隐藏默认的WordPress注释表单。

I have a plugin that enables Facebook commenting on WordPress. Users have requested a feature that will hide the default WordPress comments form on posts where Facebook commenting is enabled.

如何隐藏WP注释表单?我知道我可以从 comments.php 模板中注释掉 comment_form(); ,但我想要

How do I go about hiding the WP comments form on the fly? I know I can comment out comment_form(); from the comments.php template, but I'd like to be able to hide/unhide it at the click on a button.

它是否与 comments_template 有关,它可以隐藏/取消隐藏它。过滤器?

Does it have something to do with the comments_template filter?

插件的首页是 http:// grahamswan .com / facebook-comments

推荐答案

将表单包含在div中,并使用这个简单的jquery /隐藏div。

Wrap the form in a div and use this simple piece of jquery to show/hide the div.

<div class="comments">
<?php comment_form(); ?>
</div>

<a class="comment_switch">Show / Hide Comments</a>

.hidden{display:none;}

$("comment_switch").click(function () {
     $("comments").toggleClass("hidden")");
   });

这篇关于我如何隐藏WordPress的评论表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆