admin管理员组文章数量:1323342
Currently I'm trying to create a large header (jumbotron) on my website. The large header is loaded as inline css with the following code:
<div class="fill" style="background-image:url('<?php echo img url ?>')"></div>
I'm using the Multi-post-thumbnails plugin to create metaboxes to upload extra images. The image I'm trying to load is 'header-image'. The plugin normaly creates the complete etc which I don't need.
Does anyone know how I can get the URL of the image?
Currently I'm trying to create a large header (jumbotron) on my website. The large header is loaded as inline css with the following code:
<div class="fill" style="background-image:url('<?php echo img url ?>')"></div>
I'm using the Multi-post-thumbnails plugin to create metaboxes to upload extra images. The image I'm trying to load is 'header-image'. The plugin normaly creates the complete etc which I don't need.
Does anyone know how I can get the URL of the image?
Share Improve this question asked Dec 16, 2014 at 9:53 rwzdoornrwzdoorn 3856 silver badges24 bronze badges2 Answers
Reset to default 1found the solution:
<div class="fill" style="background-image:url('<?php $custom = MultiPostThumbnails::get_post_thumbnail_id(get_post_type(), 'header-image', $post->ID); $custom=wp_get_attachment_image_src($custom,'header image'); echo $custom[0]; ?>');"></div>
The easiest way to get the URL for the thumbnail would be:
<?php echo MultiPostThumbnails::get_post_thumbnail_url(get_post_type(), 'header-image', $post->ID); ?>
本文标签: Multiple post imageecho url (path of image)
版权声明:本文标题:Multiple post image, echo url (path of image) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742134220a2422298.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论