rss_enclosure
函数
rss_enclosure ( No parameters )
- 定义位置
-
-
wp-includes/feed.php
, line 473
-
wp-includes/feed.php
- 引入
- 1.5.0
- 弃用
- –
显示当前文章的rss enclosure。
使用全局$post来检查该文章是否需要密码,以及用户是否有该文章的密码。如果没有,那么它将在显示之前返回。
也使用函数get_post_custom()来获取文章的’enclosure’元数据字段,并解析其值来显示enclosure(s)。围栏由带有URI和其他属性的围栏HTML标签组成。
function rss_enclosure() {
if ( post_password_required() ) {
return;
}
foreach ( (array) get_post_custom() as $key => $val ) {
if ( 'enclosure' === $key ) {
foreach ( (array) $val as $enc ) {
$enclosure = explode( "n", $enc );
// Only get the first element, e.g. 'audio/mpeg' from 'audio/mpeg mpga mp2 mp3'.
$t = preg_split( '/[ t]/', trim( $enclosure[2] ) );
$type = $t[0];
/**
* Filters 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', ' ' . "n" );
}
}
}
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。


