rss_enclosure [ WordPress Function ]
| Uses: | |
| Defined at: |
|
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.
Source
<?php
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("\n", $enc);
//only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3'
$t = preg_split('/[ \t]/', trim($enclosure[2]) );
$type = $t[0];
echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . $type . '" />' . "\n");
}
}
}
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/rss enclosure « WordPress Codex
Description. 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 ...
codex.wordpress.org - RSS enclosure - Wikipedia, the free encyclopedia
RSS enclosures are a way of attaching multimedia content to RSS feeds by providing the URL of a file associated with an entry, such as an MP3 file to a music ...
en.wikipedia.org - rss_enclosure Wordpress hook details -- Adam Brown, BYU Political ...
Detailed information about every action hook and filter used in WordPress. Makes Plugin API easier to use. Lists appearance, file location, and deprecation data ...
adambrown.info - RSS enclosure Element
Free HTML XHTML CSS JavaScript jQuery XML DOM XSL XSLT RSS AJAX ASP .NET PHP SQL tutorials, references, examples for web building.
www.w3schools.com
Gebruikersdiscussies [ wordpress.org ]
- ericmcgregor on "Enclosure Feild Output as a Link"
- bizecom on "Enclosure Feild Output as a Link"
- Orin on "Enclosure Feild Output as a Link"
- Orin on "Enclosure Feild Output as a Link"
- Orin on "Enclosure Feild Output as a Link"
- Orin on "Enclosure Feild Output as a Link"
- Orin on "Enclosure Feild Output as a Link"