posts - Set featured image as hero image on each page

I want my post's featured image show as a full width hero image.I have tried to set the featured images as backgro

I want my post's featured image show as a full width hero image. I have tried to set the featured images as background images in a full-width row, but I think it is not possible.

If anyone have the answer or a way to set the featured image as a hero, then please suggest.

I want my post's featured image show as a full width hero image. I have tried to set the featured images as background images in a full-width row, but I think it is not possible.

If anyone have the answer or a way to set the featured image as a hero, then please suggest.

Share Improve this question asked Feb 21, 2020 at 13:27 Suman MSuman M 31 bronze badge 1
  • Please edit your question to specify what you've tried and what specific problems you're having. Relevant code samples will make it much easier to assist you. – Pat J Commented Feb 21, 2020 at 17:32
Add a comment  | 

1 Answer 1

Reset to default 0

You need to look at how your theme is rendering the hero image. Then, before it does so, add an if block which checks for a featured image. If a featured image exists, replace the hero image with it. Your code will look something like this.


if ( has_post_thumbnail() ) {
  // render hero image using the_post_thumbnail() instead
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744726088a4590186.html

相关推荐

  • posts - Set featured image as hero image on each page

    I want my post's featured image show as a full width hero image.I have tried to set the featured images as backgro

    13小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信