【发布时间】:2011-09-30 12:38:53
【问题描述】:
因此,我的目标是找到一种添加更多缩略图的方法,仅用于在自定义帖子类型上显示,例如,我希望为特色帖子提供大图像(不是同一图像),为默认帖子提供不同的图像查看。
【问题讨论】:
标签: wordpress
因此,我的目标是找到一种添加更多缩略图的方法,仅用于在自定义帖子类型上显示,例如,我希望为特色帖子提供大图像(不是同一图像),为默认帖子提供不同的图像查看。
【问题讨论】:
标签: wordpress
最后我遵循了这个教程,它完全符合我对 T 的要求。
http://www.lifeonlars.com/wordpress/how-to-add-multiple-featured-images-in-wordpress
【讨论】:
你试过这个add_image_size
你为什么不使用custom post template plugin
【讨论】:
我从网上得到了解决方案。我还定制了一些代码。你可以检查一下。
第 1 步 从此link 下载此库并放在functions.php 旁边(主题根)。
第 2 步: 将此代码复制到 functions.php。
/*
* Code for Multiple Featured Image.
* Multiple Featured image is only for your selected post type.
*/
require_once('library/multi-post-thumbnails.php');
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(array(
'label' => '2nd Feature Image',
'id' => 'feature-image-2',
'post_type' => 'your_post_type_name'
)
);
new MultiPostThumbnails(array(
'label' => '3rd Feature Image',
'id' => 'feature-image-3',
'post_type' => 'your_post_type_name'
)
);
new MultiPostThumbnails(array(
'label' => '4th Feature Image',
'id' => 'feature-image-4',
'post_type' => 'your_post_type_name'
)
);
};
第 3 步立即检查。
【讨论】:
我可以在这里写完整的代码,但是点击这个tutorial link 更容易:)
【讨论】: