post_comments_feed_link()获取当前文章的评论Feed订阅网址

目录

描述

译文

输出文章的评论feed链接。链接内容放置在锚(anchor)中。未指定链接文本时使用默认内容。未指定文章编号时使用当前文章。

原文

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.

post_comments_feed_link() 描述

用法

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

post_comments_feed_link() 用法

参数

$link_text

(string) (可选) Descriptive text.

默认值: 'Comments Feed'

$post_id

(string) (可选) Post ID.

默认值: Current post

$feed

(string) (可选) Type of feed. Possible values: atom, rdf, rss, rss2.

默认值: rss2

post_comments_feed_link() 参数

返回值

(string

Link to the comment feed for the current post.

post_comments_feed_link() 返回值

历史

添加于 版本: 2.5.0

post_comments_feed_link() 历史

源文件

post_comments_feed_link() 函数的代码位于 wp-includes/link-template.php

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Display the comment feed link for a post.
 *
 * 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.
 *
 * @since 2.5.0
 *
 * @param string $link_text Descriptive text.
 * @param int    $post_id   Optional post ID. Default to current post.
 * @param string $feed      Optional. Feed format.
*/
function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
	$url = esc_url( get_post_comments_feed_link( $post_id, $feed ) );
	if ( empty($link_text) )
		$link_text = __('Comments Feed');

	/**
	 * Filter 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_text", $post_id, $feed );
}

post_comments_feed_link() 源文件

相关