dino1 on "Featured image as header background"

ساخت وبلاگ

My site header is supposed to have featured image as header background but I can't figure out how to code that. This is the current code:

HTML

<div id="header">
/* Header contetnt */
</div>

CSS

#header { height: 270px; width: 100%; background: #ffcc00 url(/* static image url*/) no-repeat center center; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;
}

Can someone please help me, what code should I use?

what have you tried?
have you searched the forum topics https://wordpress.org/search/featured+image+as+background+image+wordpress?forums=1 ?

I tried some of those topics but it just wouldn't show any image

Something like this (more or less) should work

Check to see if the function retus <img src.. etc> or just the URL.

<div id="header">
/* Header contetnt */
<style>
#header { background: url('<?php echo get_the_post_thumbnail(); ?>'); /* other relevant css */
}
</style>
other header stuff
</div>

see https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/

I don't know what's wrong with code but whatever I try it just wont show the thumbnail

Please provide a link to the page on which you've implemented this.

link
it's the div below header with a white div inside that contains the title

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 296 تاريخ : دوشنبه 31 خرداد 1395 ساعت: 3:41