wordpress多功能图像插件的If条件
我已经设置了多功能图像插件。那工作对我很好 我的要求是:wordpress多功能图像插件的If条件,wordpress,image,post,dynamic-featured-image,Wordpress,Image,Post,Dynamic Featured Image,我已经设置了多功能图像插件。那工作对我很好 我的要求是: if: The Multiple Post Thumbnail Exists then: Show the Multiple Post Thumbnail Image else: Show the Default Featured Image Thumbnail 现在,我使用以下代码显示了多个功能图像: <?php add_image_size('post-big-artful-interiorsimg-fullsize'
if: The Multiple Post Thumbnail Exists
then: Show the Multiple Post Thumbnail Image
else: Show the Default Featured Image Thumbnail
现在,我使用以下代码显示了多个功能图像:
<?php add_image_size('post-big-artful-interiorsimg-fullsize', full);
if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'big-artful-interiors', NULL, 'post-big-artful-interiorsimg-fullsize');
endif;
?>
<?php the_post_thumbnail('thevoux-single',array('itemprop'=>'image')); ?>
和使用以下代码的默认特征图像显示:
<?php add_image_size('post-big-artful-interiorsimg-fullsize', full);
if (class_exists('MultiPostThumbnails')) : MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'big-artful-interiors', NULL, 'post-big-artful-interiorsimg-fullsize');
endif;
?>
<?php the_post_thumbnail('thevoux-single',array('itemprop'=>'image')); ?>
因此,请帮助我如何显示默认的特色图像,如果多个特色图像不可用。有什么想法就告诉我
谢谢。试试这段代码
<?php if (class_exists('MultiPostThumbnails') && MultiPostThumbnails::has_post_thumbnail('post', 'big-artful-interiors')) {
add_image_size('post-big-artful-interiorsimg-fullsize', full);
MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'big-artful-interiors', NULL, 'post-big-artful-interiorsimg-fullsize');
} else {
the_post_thumbnail('thevoux-single',array('itemprop'=>'image'));
} ?>
试试这个,请格式化代码并重新发送。谢谢。这对你有用吗?然后我将添加答案!!我只喜欢格式化代码。因此,首先请格式化代码,然后我会测试。尝试下面的代码,如果它的作品请让我知道没有工作。如果MultiPostThumbnails图像不可用,则无法显示默认特征图像。使用您的代码,我已经应用了我的逻辑,并且条件是否正常。谢谢