I use this plugin to echo the URL of a post’s featured image in the header:
<?php
/** Plugin Name: Post Thumbnail FB header */
function fb_header()
{
// Not on a single page or post? Stop here.
if ( ! is_singular() )
return;
$post_ID = get_queried_object_id();
// We got no thumbnail? Stop here.
if ( ! has_post_thumbnail( $post_ID ) )
return;
// Get the Attachment ID
$att_ID = get_post_thumbnail_id( $post_ID );
// Get the Attachment
$att = wp_get_attachment_image_src( $att_ID );
printf(
'<link rel="image_src" href="%s" />'
,array_shift( $att )
);
}
add_action( 'wp_head', 'fb_header' );
?>
As it stands currently, it echo’s the featured image. I want it to echo the URL of the Large version of the featured image. How can I do this? Just to note that all my featured images have a large version…
Use the second parameter of
wp_get_attachment_image_src()
:$size
.or
The size is passed to
image_downsize()
and there toimage_get_intermediate_size()
. If$size
is an array WordPress will search for the best match in existing images: