I have Genesis and a Genesis Theme installed. Now I would like to make some customization's so I have created a child-theme and activated it. I have made CSS changes and everything works. Now I would like to overwrite the header.php file from the the Genesis theme so I have copied the header.php file to my child-theme in hopes I would be able to overwrite the parent themes header.php. But any change I make to my child-theme's header.php file does not work. Any idea's how I can overwrite the parent's header.php file?
Asked
Active
Viewed 1,787 times
1
-
1You copied the `header.php` file in the root of your Genesis folder to the root of your child theme folder? That should overwrite it. I ran a test and it did. – jer0dh Feb 18 '17 at 13:41
-
I think I miss understood how Genesis works. I have Genesis installed and a genesis theme installed. What I did was make an additional child-theme for the genesis theme so I have 3 themes, but it looks like this is wrong? I should just have 2 theme files correct? – Hubvill Feb 18 '17 at 14:42
-
1@Hubvill you said you have genesis and genesis theme, then you created own child theme also.. what you mean by Genesis theme? as please know , genesis is framework, then every other theme you install is Child theme.. and there are no support for grandchild themes.. i.e. you have just genesis+your activated child theme... so make sure you have got it right. – Muhammad Asadullah Feb 19 '17 at 08:43
-
Yes I didn't understand correctly how Genesis works and made a grand-child theme on accident. Thanks for clearing that up. – Hubvill Feb 20 '17 at 01:07
2 Answers
0
Grab the code from header.php inside genesis > lib > structure > header.php near line 623 and modify it in your child themes functions.php file like this:
remove_action('genesis_header','genesis_do_header');
add_action('genesis_header','genesis_custom_header');
function genesis_custom_header() {
global $wp_registered_sidebars;
genesis_markup( array(
'open' => '<div %s>',
'context' => 'title-area',
) );
do_action( 'genesis_site_title' );
do_action( 'genesis_site_description' );
genesis_markup( array(
'close' => '</div>',
'context' => 'title-area',
) );
if ( ( isset( $wp_registered_sidebars['header-right'] ) && is_active_sidebar( 'header-right' ) ) || has_action( 'genesis_header_right' ) ) {
genesis_markup( array(
'open' => '<div %s>' . genesis_sidebar_title( 'header-right' ),
'context' => 'header-widget-area',
) );
do_action( 'genesis_header_right' );
add_filter( 'wp_nav_menu_args', 'genesis_header_menu_args' );
add_filter( 'wp_nav_menu', 'genesis_header_menu_wrap' );
dynamic_sidebar( 'header-right' );
remove_filter( 'wp_nav_menu_args', 'genesis_header_menu_args' );
remove_filter( 'wp_nav_menu', 'genesis_header_menu_wrap' );
genesis_markup( array(
'close' => '</div>',
'context' => 'header-widget-area',
) );
}
}

Dev
- 457
- 6
- 18
0
normally header of genesis theme have this code
/**
* Fires immediately after the site container opening markup, before `genesis_header` action hook.
*
* @since 1.0.0
*/
do_action( 'genesis_before_header' );
/**
* Fires to display the main header content.
*
* @since 1.0.2
*/
do_action( 'genesis_header' );
/**
* Fires immediately after the `genesis_header` action hook, before the site inner opening markup.
*
* @since 1.0.0
*/
do_action( 'genesis_after_header' );
You have to change it like this.
/**
* Fires immediately after the site container opening markup, before `genesis_header` action hook.
*
* @since 1.0.0
*/
do_action( 'genesis_before_header' );
/**
* Fires to display the main header content.
*
* @since 1.0.2
*/
do_action( 'my_custom_header' );
/**
* Fires immediately after the `genesis_header` action hook, before the site inner opening markup.
*
* @since 1.0.0
*/
do_action( 'genesis_after_header' );
Now in function.php or in header.php add your custom header like this.
add_action( 'my_custom_header', 'my_custom_header');
function my_custom_header() { ?> <header> Your header code </header><?php } ?>

tasz rex
- 1