Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_the_attachment_link [ WordPress Function ]

get_the_attachment_link ( $id = 0, $fullsize = false, $max_dims = false, $permalink = false )
Parameters:
  • (int) $id Optional. Post ID.
  • (bool) $fullsize Optional, default is false. Whether to use full size image.
  • (array) $max_dims Optional. Max image dimensions.
  • (bool) $permalink Optional, default is false. Whether to include permalink to image.
See:
Returns:
  • (string)
Defined at:



Retrieve HTML content of attachment image with link.

Source


<?php
function get_the_attachment_link($id 0$fullsize false$max_dims false$permalink false) {
    
_deprecated_function__FUNCTION__'2.5''wp_get_attachment_link()' );
    
$id = (int) $id;
    
$_post = & get_post($id);

    if ( (
'attachment' != $_post->post_type) || !$url wp_get_attachment_url($_post->ID) )
        return 
__('Missing Attachment');

    if ( 
$permalink )
        
$url get_attachment_link($_post->ID);

    
$post_title esc_attr($_post->post_title);

    
$innerHTML get_attachment_innerHTML($_post->ID$fullsize$max_dims);
    return 
"<a href='$url' title='$post_title'>$innerHTML</a>";
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics