doudang9147 2015-10-29 17:06
浏览 52
已采纳

如何在Wordpress博客中使用特色图像中的不同缩略图?

On a Wordpress site I am maintaining, the client wants to have a different header image for the blog post than what appears in the thumbnail on the blog roll page and wherever the thumbnail to the blog post appears on the site.

Right now it seems that the featured image is used for both the header image and the thumbnail.

Is there a way where these images can be different?

Any help is appreciated, thanks!

  • 写回答

1条回答 默认 最新

  • dqqxkq4047 2015-10-29 17:19
    关注

    If you do this through your theme files or if you develop a plugin, it is not easy to explain it here. But you can use a plugin and do this easily. 1. "Multiple Post Thumbnails" plugin. Install this on your site ( or download this file and include it on your functions.php file https://github.com/voceconnect/multi-post-thumbnails/blob/master/multi-post-thumbnails.php ) and add following code to use another post image.

    if (class_exists('MultiPostThumbnails')) {
        new MultiPostThumbnails(
            array(
                'label' => 'Secondary Image',
                'id' => 'secondary-image',
                'post_type' => 'post'
            )
        );
    }
    

    After that you can call for images using,

    get_the_post_thumbnail($post_type, $thumb_id, $post_id, $size, $attr, $link_to_original);
    

    And also you can use add_image_size( $size_id, $width, $height, $hard_crop ); function to specify the size of the image.

    1. "Advanced Custom Field" Plugin Using this plugin you can do many more things. And you can add any numbers of post thumbnails using this. And almost all the other custom input types can be easily add to your theme.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改