• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Genesis Custom Header – position override?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Genesis Custom Header – position override?

This topic is: not resolved

Tagged: center, Custom header

  • This topic has 1 reply, 2 voices, and was last updated 8 years, 4 months ago by Brad Dalton.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • September 22, 2014 at 12:54 pm #125347
    PittsburghChris
    Member

    In a Genesis child theme, I can enable support for adding Custom Header images by adding this to my functions file:

    add_theme_support( 'genesis-custom-header', array( 'width' => 1250, 'height' => 500 ) );

    Then I can go into the Dashboard --> Appearance --> Header and upload an image. Genesis takes this image and adds it as a "background" to the .site-header class of the "header" HTML element.

    However, in the Genesis core files:

    genesis/lib/structure/header.php

    the styling for .site-header is as follows:

    //* Header image CSS, if exists
    	if ( $header_image )
    		$output .= sprintf( '%s { background: url(%s) no-repeat !important; }', $header_selector, esc_url( $header_image ) );

    The !important declaration is preventing me from adding any additional styles to the .site-header's background. Specifically, I am trying to position the image in the center. I would like to have the code read:

    .site-header {background:url(path/wp-content/uploads/2014/09/banner.jpg) no-repeat top center;}

    I cannot find a way to override the !important declaration in order to position the element. I even tried to use a custom function redeclaring the $output, but it did not work since I guess the child theme loads before the Genesis header.php file.

    I want to use the custom header support because I would like to provide the end-user with an option of adding their own image (using the dashboard) but I would like the image centered, not aligned to the left margin.

    I suppose I will need to create a header widget and use something like the "Image Widget" plugin to get around this, but it seems like I should be able to get this done simply by using what is already built into the system.

    Can anyone shed any light on this for me and help me understand? What am I missing? Thank you!

    September 22, 2014 at 5:37 pm #125389
    Brad Dalton
    Participant

    Change the width to match your header image.


    Get Help – Book Consultation.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble