rss_enclosure()

显示当前帖子的rss附件。

rss_enclosure()

说明(Description)

使用全局$post检查post是否需要密码,以及用户是否具有post的密码。如果没有,它将在显示之前返回。


返回(Return)

无返回值


源码(Source)

/**
 * Display the rss enclosure for the current post.
 *
 * Uses the global $post to check whether the post requires a password and if
 * the user has the password for the post. If not then it will return before
 * displaying.
 *
 * Also uses the function get_post_custom() to get the post's 'enclosure'
 * metadata field and parses the value to display the enclosure(s). The
 * enclosure(s) consist of enclosure HTML tag(s) with a URI and other
 * attributes.
 *
 * @since 1.5.0
 */
function rss_enclosure() {
	if ( post_password_required() )
		return;
	foreach ( (array) get_post_custom() as $key => $val) {
		if ($key == 'enclosure') {
			foreach ( (array) $val as $enc ) {
				$enclosure = explode("
", $enc);
				// only get the first element, e.g. audio/mpeg from 'audio/mpeg mpga mp2 mp3'
				$t = preg_split('/[ 	]/', trim($enclosure[2]) );
				$type = $t[0];
				/**
				 * Filter the RSS enclosure HTML link tag for the current post.
				 *
				 * @since 2.2.0
				 *
				 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
				 */
				echo apply_filters( 'rss_enclosure', '' . "
" );
			}
		}
	}
}
更新版本源码位置使用被使用
1.5.0wp-includes/feed.php:46807
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索