php - Multiple Post Thumbnails $imgURL -
i have title background image , in template file need use secondary image of multiple post thumbnails plugin instead of feautured img. code @ beginning:
<?php if (has_post_thumbnail()) { //if thumbnail has been set $imgid = get_post_thumbnail_id($post->id); //get id of featured image $featuredimage = wp_get_attachment_image_src($imgid, 'full' );//get url of featured image (returns array) $imgurl = $featuredimage[0]; //get url of image out of array ?> <style type="text/css"> .header-image { border:none; color:black; background: url(<?php echo $imgurl ?>) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; min-height:580px; display:block; position:relative; width: 100%; overflow: hidden;} </style> <?php }//end if ?>
i have change $imgurl , put 1 of secondary image.
i tried:
<?php if (has_post_thumbnail()) { //if thumbnail has been set $imgid = get_post_thumbnail_id($post->id); //get id of featured image $featuredimage = wp_get_attachment_image_src($imgid, 'full' );//get url of featured image (returns array) $imgurl = apply_filters( 'secondary-image', '', array( 'image_size' => 'large' ) ); ?>
but doesn't work... ideas? thank
try using:
$imgurl = multipostthumbnails::get_post_thumbnail_url(get_post_type(), 'secondary-image', null, 'large');
this return url of secondary image "large" image size.
just information, here faq page plugin might helpful if need further details usage of multiple post thumbnails plugin: https://github.com/voceconnect/multi-post-thumbnails/wiki/frequently-asked-questions
Comments
Post a Comment