wordpress技巧

一般我们使用的WordPress主题默认都会在评论框的下面显示一段提示可以使用的HTML标签,不过我想一般情况下,您大概不太愿意有什么超链接或者其它的格式化的文本出现在您的评论中吧,而且这么一大段放在那里也是不太和谐的。

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

去除它也是很简单的,你可以选择移除这个显示功能或者也可以选择隐藏这段文字,眼不见为净么。

移除输出功能法

1.修改文件comment-template.php

打开wp-includes/comment-template.php文件,找到

<?php echo $args['comment_notes_after']; ? >

将其注释

<!--?php echo $args['comment_notes_after']; ? –>

或者直接删除这行代码。

2.修改主题的functions.php

打开你主题的functions.php文件,加入下面的代码

/**
* Remove the text - 'You may use these <abbr title="HyperText Markup
* Language">HTML</abbr> tags ...'
* from below the comment entry box.
*/

add_filter('comment_form_defaults', 'remove_comment_styling_prompt');

function remove_comment_styling_prompt($defaults) {
    $defaults['comment_notes_after'] = '';
    return $defaults;
}

隐藏法

打开你主题的style.css文件,加入下面的样式

#respond .form-allowed-tags {
  clear: both;
  width: 98%;
}
#respond .form-allowed-tags code {
  display: block;
}
.form-allowed-tags {
  display: none;
}

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注