返回介绍

post_comments_feed_link()

发布于 2017-09-11 09:56:18 字数 2898 浏览 1038 评论 0 收藏 0

post_comments_feed_link( string $link_text = '',  int $post_id = '',  string $feed = '' )

Displays the comment feed link for a post.


description

Prints out the comment feed link for a post. Link text is placed in the anchor. If no link text is specified, default text is used. If no post ID is specified, the current post is used.


参数

$link_text

(string) (Optional) Descriptive link text. Default 'Comments Feed'.

Default value: ''

$post_id

(int) (Optional) Post ID. Default is the ID of the global $post.

Default value: ''

$feed

(string) (Optional) Feed format.

Default value: ''


源代码

File: wp-includes/link-template.php

function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
	$url = get_post_comments_feed_link( $post_id, $feed );
	if ( empty( $link_text ) ) {
		$link_text = __('Comments Feed');
	}

	$link = '<a href="' . esc_url( $url ) . '">' . $link_text . '</a>';
	/**
	 * Filters the post comment feed link anchor tag.
	 *
	 * @since 2.8.0
	 *
	 * @param string $link    The complete anchor tag for the comment feed link.
	 * @param int    $post_id Post ID.
	 * @param string $feed    The feed type, or an empty string for the default feed type.
	 */
	echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed );
}

更新日志

Versiondescription
2.5.0Introduced.

相关函数

Uses

  • wp-includes/l10n.php: __()
  • wp-includes/formatting.php: esc_url()
  • wp-includes/link-template.php: get_post_comments_feed_link()
  • wp-includes/link-template.php: post_comments_feed_link_html
  • wp-includes/plugin.php: apply_filters()

Used By

  • wp-includes/deprecated.php: comments_rss_link()

User Contributed Notes

  1. Skip to note content You must log in to vote on the helpfulness of this noteVote results for this note: 0You must log in to vote on the helpfulness of this note Contributed by Codex

    Basic Usage

    
    <?php
       post_comments_feed_link( $link_text = 'link_text', $post_id = 'post_id',
             $feed = 'feed_type' );
    ?> 
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文