Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active May 16, 2022 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save srikat/8930307 to your computer and use it in GitHub Desktop.
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/
//* 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>';
}
if ( is_active_sidebar( 'home-about' ) || is_active_sidebar( 'home-portfolio' ) || is_active_sidebar( 'home-services' ) || is_active_sidebar( 'home-blog' ) ) {
if ( is_active_sidebar( 'home-portfolio' ) || is_active_sidebar( 'home-services' ) || is_active_sidebar( 'home-blog' ) ) {
genesis_widget_area( 'home-about', array(
'before' => '<div id="about"><div class="wrap">',
'after' => '</div></div>',
) );
/*
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