atom_enclosure

Display the atom enclosure for the current post.

Description

atom_enclosure(); 

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 link HTML tag(s) with a URI and other attributes.


Usage

  1. if ( !function_exists( 'atom_enclosure' ) ) { 
  2. require_once ABSPATH . WPINC . '/feed.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = atom_enclosure(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/feed.php  
  1. function atom_enclosure() { 
  2. return; 
  3.  
  4. foreach ( (array) get_post_custom() as $key => $val ) { 
  5. if ($key == 'enclosure') { 
  6. foreach ( (array) $val as $enc ) { 
  7. $enclosure = explode("\n", $enc); 
  8. /** 
  9. * Filter the atom enclosure HTML link tag for the current post. 
  10. * @since 2.2.0 
  11. * @param string $html_link_tag The HTML link tag with a URI and other attributes. 
  12. */ 
  13. echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\n" );