post_comments_feed_link

函式
post_comments_feed_link ( $link_text = '', $post_id = '', $feed = '' )
引數
  • (string) $link_text Optional. Descriptive link text. Default 'Comments Feed'.
    Required:
    Default: (empty)
  • (int) $post_id Optional. Post ID. Default is the ID of the global `$post`.
    Required:
    Default: (empty)
  • (string) $feed Optional. Feed type. Possible values include 'rss2', 'atom'. Default is the value of get_default_feed().
    Required:
    Default: (empty)
定義位置
相關方法
get_post_comments_feed_linkget_search_comments_feed_linkprevious_comments_linkget_comments_linkis_comment_feed
引入
2.5.0
棄用
-

post_comments_feed_link: 這個函式用來輸出文章的評論反饋的連結。

顯示一篇文章的評論連結。

列印出一個文章的評論反饋連結。連結文字被放置在
錨點。如果沒有指定連結文字,將使用預設文字。如果沒有指定文章的ID
指定,則使用當前文章。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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. Possible values include 'rss2', 'atom',
* or an empty string for the default feed type.
*/
echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed );
}
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. Possible values include 'rss2', 'atom', * or an empty string for the default feed type. */ echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed ); }
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. Possible values include 'rss2', 'atom',
	 *                        or an empty string for the default feed type.
	 */
	echo apply_filters( 'post_comments_feed_link_html', $link, $post_id, $feed );
}

常見問題

FAQs
檢視更多 >