Last active
May 16, 2022 16:20
-
-
Save srikat/8930307 to your computer and use it in GitHub Desktop.
Adding a background image for Header and About section in Modern Portfolio Pro. http://sridharkatakam.com/add-background-image-header-section-modern-portfolio-pro/
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
//* Add custom Header + About container's opening div tag | |
add_action( 'genesis_before_header', 'sk_home_opening_div' ); | |
function sk_home_opening_div() { | |
if (! is_front_page() ) | |
return; | |
echo '<div class="header-about-wrapper">'; | |
} | |
//* Display the contents of 'Home - About' widget area | |
add_action( 'genesis_after_header', 'sk_home_about' ); | |
function sk_home_about() { | |
if (! is_front_page() ) | |
return; | |
genesis_widget_area( 'home-about', array( | |
'before' => '<div id="about"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); | |
} | |
//* Add custom Header + About container's closing div tag | |
add_action( 'genesis_after_header', 'sk_home_closing_div' ); | |
function sk_home_closing_div() { | |
if (! is_front_page() ) | |
return; | |
echo '</div>'; | |
} |
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
if ( is_active_sidebar( 'home-about' ) || is_active_sidebar( 'home-portfolio' ) || is_active_sidebar( 'home-services' ) || is_active_sidebar( 'home-blog' ) ) { |
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
if ( is_active_sidebar( 'home-portfolio' ) || is_active_sidebar( 'home-services' ) || is_active_sidebar( 'home-blog' ) ) { |
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
genesis_widget_area( 'home-about', array( | |
'before' => '<div id="about"><div class="wrap">', | |
'after' => '</div></div>', | |
) ); |
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
/* | |
Adding a background image for Header and About section | |
----------------------------------------------------------- */ | |
.header-about-wrapper { | |
background: url('images/top-image-1600x748.jpg') center top no-repeat; | |
-webkit-background-size: cover; | |
-moz-background-size: cover; | |
-o-background-size: cover; | |
background-size: cover; | |
min-height: 584px; | |
} | |
#about { | |
background: rgba(0, 0, 0, 0.5); | |
margin-top: 300px; | |
} | |
@media only screen and (max-width: 480px) { | |
.header-about-wrapper { | |
min-height: 100px; | |
} | |
#about { | |
margin-top: 100px; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment