最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

functions - Can I use 'Featured Image' as a hero image and a thumbnail?

programmeradmin0浏览0评论

I am finding a lot of great information for using the_post_thumbnail() to use this feature as a post hero OR a thumbnail, but I'm struggling to figure out how to use the 'Featured image' as both in my templates.

Here's the gist of what I'm trying do:

  1. user uploads a featured image to post, which is cropped to 2400 x 1350 px (hero)
  2. image is also scaled and saved as a thumb at 880 x 495 px (pixel perfect scaling ratio from hero)
  3. embed hero size the_post_thumbnail('large') in single.php template and the_post_thumbnail('thumb') on the homepage for the post preview

I think I understand how to access and embed the sizes that I would like to use in the appropriate places but I don't understand the workflow for cropping the image on upload and scaling it to multiple sizes. I found set_post_thumbnail_size(), which gets me halfway there, but how do I create multiple sizes?

发布评论

评论列表(0)

  1. 暂无评论