admin管理员组文章数量:1023025
I've been using the Multiple Post Thumbnail plugin with my custom post types to use a secondary, smaller image on my archive pages, while I have a larger hero image in the header of the single post (these are two different images, not a smaller and larger version of the same image).
Previously, the code worked well, but suddenly it stopped returning the post thumb url.
The code in my functions.php file:
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Secondary Image',
'id' => 'secondary-image',
'post_type' => 'episodes'
)
);
}
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Secondary Image',
'id' => 'secondary-image',
'post_type' => 'resources'
)
);
}
The code in the loops on my custom post types' archive pages:
<? $custhumburl = MultiPostThumbnails::get_post_thumbnail_url('episodes', 'secondary-image', NULL, 'secondary-image'); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class('grid-box inline-item thumb') ?> itemscope itemtype="">
<a href="<?php the_permalink(); ?>" itemprop="significantLink">
<span class="display-block wp-post-image" style="background-image:url(<?php echo $custhumburl ?>);"></span>
<span class="bg-gray-solid border-radius-bottom display-block lato all-padding">
<h3 class="center-text gray-text lato letter-spacing-heading sub-heading-font text-padding uppercase" itemprop="title"><?php the_subtitle(); ?></h3>
<h2 class="black-text capitalize center-text font-light heading-font roboto" itemprop="title"><?php the_title(); ?></h2>
</span><!-- End post meta -->
</a><!-- End post anchor tag -->
</div><!-- End grid-box - post thumbnail -->
When I open Dev Tools, the image url is blank:
<span class="display-block wp-post-image" style="background-image:url();"></span>
I've been using the Multiple Post Thumbnail plugin with my custom post types to use a secondary, smaller image on my archive pages, while I have a larger hero image in the header of the single post (these are two different images, not a smaller and larger version of the same image).
Previously, the code worked well, but suddenly it stopped returning the post thumb url.
The code in my functions.php file:
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Secondary Image',
'id' => 'secondary-image',
'post_type' => 'episodes'
)
);
}
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Secondary Image',
'id' => 'secondary-image',
'post_type' => 'resources'
)
);
}
The code in the loops on my custom post types' archive pages:
<? $custhumburl = MultiPostThumbnails::get_post_thumbnail_url('episodes', 'secondary-image', NULL, 'secondary-image'); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class('grid-box inline-item thumb') ?> itemscope itemtype="">
<a href="<?php the_permalink(); ?>" itemprop="significantLink">
<span class="display-block wp-post-image" style="background-image:url(<?php echo $custhumburl ?>);"></span>
<span class="bg-gray-solid border-radius-bottom display-block lato all-padding">
<h3 class="center-text gray-text lato letter-spacing-heading sub-heading-font text-padding uppercase" itemprop="title"><?php the_subtitle(); ?></h3>
<h2 class="black-text capitalize center-text font-light heading-font roboto" itemprop="title"><?php the_title(); ?></h2>
</span><!-- End post meta -->
</a><!-- End post anchor tag -->
</div><!-- End grid-box - post thumbnail -->
When I open Dev Tools, the image url is blank:
<span class="display-block wp-post-image" style="background-image:url();"></span>
本文标签: pluginsMultiple Post Thumbnails Not Returning URL for Background Image
版权声明:本文标题:plugins - Multiple Post Thumbnails Not Returning URL for Background Image 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745593605a2158029.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论