wp_get_attachment_link [ WordPress Function ]
wp_get_attachment_link ( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false )
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: get_attachment_link, wp_get_attachment_url, get_the_attachment_link, wp_get_attachment_image, the_attachment_link
Retrieve an attachment page link using an image or icon, if possible.
Source
<?php
function wp_get_attachment_link( $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) {
$id = intval( $id );
$_post = & get_post( $id );
if ( empty( $_post ) || ( '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 );
if ( $text )
$link_text = $text;
elseif ( $size && 'none' != $size )
$link_text = wp_get_attachment_image( $id, $size, $icon );
else
$link_text = '';
if ( trim( $link_text ) == '' )
$link_text = $_post->post_title;
return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon, $text );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/wp get attachment link « WordPress Codex
Description. Returns an HTML hyperlink to an attachment file or page, containing either. An image at some specified size, for image attachments; or; A media ...
codex.wordpress.org - WordPress › Support » wp_get_attachment_link
I'm using wp_get_attachment_link to link an image on my front page to the post. But it sends me to a post with the name of the attachment as the name of the ...
wordpress.org - wp_get_attachment_link Wordpress hook details -- Adam Brown ...
wp_get_attachment_link. WordPress version history for wp_get_attachment_link. This database has information for all major versions from WP 1.2.1 through 3.3.
adambrown.info - Wordpress Add a custom class to wp_get_attachment_link
Nov 4, 2011 ... wordpress Add a custom class to wp_get_attachment_link, attachment, functions. php, library, media, posts, theme.
wpsnipp.com
Gebruikersdiscussies [ wordpress.org ]
- kbkisan on "Create filter for wp_get_attachment_link"
- jobmeer on "hook on wp_get_attachment_link"
- Matthew on "Getting attachment width for medium size"
- Matthew on "Getting attachment width for medium size"
- Matthew on "Getting attachment width for medium size"
- Matthew on "Getting attachment width for medium size"
- wprabbit on "How do you show an attachment without linking to the raw file"
- generalsalt on "wp_get_attachment_link"
- wdm on "How do you show an attachment without linking to the raw file"
- sponki on "How do you show an attachment without linking to the raw file"