the_attachment_link

Display an attachment page link using an image or icon.

Description

the_attachment_link( (int) $id = 0, (constant) $fullsize = false, (constant) $deprecated = false, (bool) $permalink = false ); 

Parameters (4)

0. $id — Optional. (int)
Post ID or post object.
1. $fullsize — Optional. (constant) => false
Optional, default is false. Whether to use full size.
2. $deprecated — Optional. (constant) => false
Deprecated. Not used.
3. $permalink — Optional. (bool) => false
Optional, default is false. Whether to include permalink.

Usage

  1. if ( !function_exists( 'the_attachment_link' ) ) { 
  2. require_once ABSPATH . WPINC . '/post-template.php'; 
  3.  
  4. // Optional. Post ID or post object. 
  5. $id = -1; 
  6.  
  7. // Optional, default is false. Whether to use full size. 
  8. $fullsize = false; 
  9.  
  10. // Deprecated. Not used. 
  11. $deprecated = false; 
  12.  
  13. // Optional, default is false. Whether to include permalink. 
  14. $permalink = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = the_attachment_link($id, $fullsize, $deprecated, $permalink); 
  18.  

Defined (1)

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

/wp-includes/post-template.php  
  1. function the_attachment_link( $id = 0, $fullsize = false, $deprecated = false, $permalink = false ) { 
  2. if ( !empty( $deprecated ) ) 
  3. _deprecated_argument( __FUNCTION__, '2.5.0' ); 
  4.  
  5. if ( $fullsize ) 
  6. echo wp_get_attachment_link($id, 'full', $permalink); 
  7. else 
  8. echo wp_get_attachment_link($id, 'thumbnail', $permalink);