next_comments_link_attributes
云策文档标注
概述
next_comments_link_attributes 是一个 WordPress 过滤器,用于修改指向下一页评论链接的锚标签属性。开发者可以通过此过滤器自定义链接的 HTML 属性,如添加类名。
关键要点
- 过滤器名称:next_comments_link_attributes
- 用途:过滤下一页评论链接的锚标签属性
- 参数:$attributes(字符串类型,表示锚标签的属性)
- 相关函数:get_next_comments_link()
- 引入版本:WordPress 2.7.0
代码示例
function wpdocs_comments_link_attributes() {
return 'class="your-class-name"';
}
add_filter( 'next_comments_link_attributes', 'wpdocs_comments_link_attributes' );
原文内容
Filters the anchor tag attributes for the next comments page link.
Parameters
$attributesstring-
Attributes for the anchor tag.
Source
$attr = apply_filters( 'next_comments_link_attributes', '' );
Changelog
| Version | Description |
|---|---|
| 2.7.0 | Introduced. |
Skip to note 2 content
Razon Komar Pal
To add class in
next linktag:function wpdocs_comments_link_attributes() { return 'class="your-class-name"'; } add_filter( 'next_comments_link_attributes', 'wpdocs_comments_link_attributes' );