WordPress: Genesis Header Customization

I just dive into the Genesis framework.

In a normal topic, if you want to edit the header, you open the header.php file.

But in the genesis, the header file is not in the child theme. I looked around and found a way to add custom header support, but I need to be guided.

Below is the code to enable custom header support. I assume this is included in the functions.php file. But how do I really add code here? What if I want to say that you pulled into a custom field or added a div to this section or added a slider? How do I really use this code to allow me to add html and php to the title of a child theme?

 /** Add custom header support */ add_theme_support( 'genesis-custom-header', array( 'width' => 960, 'height' => 100, 'textcolor' => '444', 'admin_header_callback' => 'minimum_admin_style' ) ); 
+4
source share
2 answers

First you need to remove the header that currently exists. All this in functions.php in your child theme

 remove_action('genesis_header','genesis_do_header'); 

Then it is as simple as building a function that will become your new heading.

 function injectHeader() { ?> <div id="title-area"> <h1>Title Here</h1> <nav>Nav Here and so on</nav> <p>You can add whatever you want</p> </div> <?php } 

I usually try to use the same class names and identifiers in order to preserve some of the inline styles and keep some work for myself, but it is up to you. All you have to do is add everything you want to the function and call it like this

 add_action('genesis_header','injectHeader'); 

Hope this helps!

+18
source

Just stumbled upon this post asking the same question. Perfect solution. An even easier way to customize certain parts of a genesis-based site is to use the Genesis Simple Hooks plugin. Just do a search, it's awesome.

0
source

Source: https://habr.com/ru/post/1502411/


All Articles