您好,我添加了multipostthumbnails插件,并使所有设置都正常,但现在当我尝试在模板中显示缩略图时,帖子图像不会显示出来。我已经检查了docs 在多端口上,结果发现您无法使用get_post_type() 当你在你的标题中或在一个页面上时,你必须直接传递帖子类型,但我仍然无法获得url来显示我的背景图像。有什么想法吗?
功能。php
new MultiPostThumbnails(array(
\'label\' => \'Banner Image\',
\'id\' => \'secondary-image\',
\'post_type\' => array( \'research\',\'events\',\'people\',\'labs\',\'publications\',\'projects\',\'equipment\',\'job\',\'media\',\'page\' )
) );
}
模板<div class="banner banner-detail row" <?php if (class_exists(\'MultiPostThumbnails\')) : ?> style="background-image: url(\'<?php MultiPostThumbnails::get_post_thumbnail_url(\'media\', \'secondary-image\'); ?>\');" <?php else : ?>style="background-image: url(\'/wp-content/themes/tqt/img/hero-dim.jpg\')" <?php endif; ?> >