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 badges
Add a comment  | 

2 Answers 2

Reset to default 1

found 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)