Last active
October 3, 2017 05:16
Star
You must be signed in to star a gist
Header di single post background dengan post thumbnail(featured image)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<header | |
id="masthead" | |
class="hero" | |
<?php | |
/** | |
* Gunakan thumbnail default jika thumbnail post tidak di set | |
*/ | |
if ( is_single() ) { | |
if ( has_post_thumbnail() ) { | |
echo "style='background: linear-gradient(rgba(26,48,96,.5), rgba(0,0,0,.8)), url(" . get_the_post_thumbnail_url(get_the_ID(),'full') . "); background-size: cover'"; | |
} else { | |
echo "style='background: linear-gradient(rgba(26,48,96,.5), rgba(0,0,0,.8)), url(https://i.imgur.com/EAwB3pp.png); background-size: cover'"; | |
} | |
} | |
?>> | |
// Konten lain lain | |
</header> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment