Changing the Genesis Header HTML Structure and MarkUp Code

In Genesis Themes you can completely change the header structure HTML  by overriding the default code from the parent Genesis theme and use your own header mark up in your Child Theme. Two types of markup can be overridden the structure and the markup.

Overriding Genesis Header Structure

The header structure content in Genesis is controlled by the code in the parent theme in the file…

genesis/lib/structure/header.php 

The three functions that control the header are:

  • genesis_header_markup_open
  • genesis_header_markup_close
  • genesis_do_header

The functions are pretty self explanatory, 2 of them contain the actual opening and closing markup and the genesis_do_header is the ‘meat in the sandwich’.

They need to be removed by the action hook that added them in

  • add_action( ‘genesis_header’, ‘genesis_header_markup_open’, 5 );
  • add_action( ‘genesis_header’, ‘genesis_header_markup_close’, 15 );
  • add_action( ‘genesis_header’, ‘genesis_do_header’ );

So in your functions.php you would remove the initial action by changing what you are doing by using remove_action, then you would add in your own header functions and add them in to the same hook ‘genesis_header’ using add_action.

In the above gist there is just one extra div added for a mark up task I needed – otherwise the code is the same as the original Genesis code.

Overriding Genesis Header Markup

The markup the builds the structure and head meta info as well as the opening site container content can be found in genesis/header.php

To override this content just make a header.php in your Genesis child theme with the same content and adjust the markup accordingly.