get_the_content_feed

函式
get_the_content_feed ( $feed_type = null )
引數
  • (string) $feed_type The type of feed. rss2 | atom | rss | rdf
    Required:
    Default: null
返回值
  • (string) The filtered content.
相關
  • get_the_content()
定義位置
相關方法
the_content_feedget_the_contentthe_contentthe_content_rssget_post_comments_feed_link
引入
2.9.0
棄用
-

get_the_content_feed: 這個函式檢索當前文章或頁面的主要內容,用於RSS提要。它不需要引數,以字串形式返回內容。

為feeds檢索文章內容。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_the_content_feed( $feed_type = null ) {
if ( ! $feed_type ) {
$feed_type = get_default_feed();
}
/** This filter is documented in wp-includes/post-template.php */
$content = apply_filters( 'the_content', get_the_content() );
$content = str_replace( ']]>', ']]>', $content );
/**
* Filters the post content for use in feeds.
*
* @since 2.9.0
*
* @param string $content The current post content.
* @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'.
* Default 'rss2'.
*/
return apply_filters( 'the_content_feed', $content, $feed_type );
}
function get_the_content_feed( $feed_type = null ) { if ( ! $feed_type ) { $feed_type = get_default_feed(); } /** This filter is documented in wp-includes/post-template.php */ $content = apply_filters( 'the_content', get_the_content() ); $content = str_replace( ']]>', ']]>', $content ); /** * Filters the post content for use in feeds. * * @since 2.9.0 * * @param string $content The current post content. * @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'. * Default 'rss2'. */ return apply_filters( 'the_content_feed', $content, $feed_type ); }
function get_the_content_feed( $feed_type = null ) {
	if ( ! $feed_type ) {
		$feed_type = get_default_feed();
	}

	/** This filter is documented in wp-includes/post-template.php */
	$content = apply_filters( 'the_content', get_the_content() );
	$content = str_replace( ']]>', ']]>', $content );

	/**
	 * Filters the post content for use in feeds.
	 *
	 * @since 2.9.0
	 *
	 * @param string $content   The current post content.
	 * @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'.
	 *                          Default 'rss2'.
	 */
	return apply_filters( 'the_content_feed', $content, $feed_type );
}

常見問題

FAQs
檢視更多 >