- This topic has 5 replies, 2 voices, and was last updated 9 years, 11 months ago by Theme Horse Support Team.
-
AuthorPosts
-
December 1, 2014 at 10:58 pm #18990spectrum_7Participant
Hello,
I need to make a small structural change to the header by adding an additional div between the hgroup-wrap div and the page-title-wrap div.
Normally this would require editing the header.php file in a child theme, however in Interface everything is hooked so not an easy edit.
I did find and hack the inc/structure/header-extensions.php file… At line 835.
However, I would like to do it the proper way so my edits are not overwritten on updates.
I am using a child theme and I tried recreating the inc/structure/ directory in my child theme and pasting a modified header-extenstions.php file there and tried pasting it also in the root of my child theme. That didn’t work.
I also tried unhooking the entire interface_headercontent_details() function and re-hooking my own version in my child theme’s functions.php. Like this:
remove_action( 'interface_header', 'interface_headercontent_details', 10 ); add_action( 'interface_header', 'my_interface_headercontent_details', 12 );
It did create a correct additional header, however it also left the original, so there were two headers. I can’t figure out how to unhook the original interface header.
Can you offer any help on modifying Interface as a child theme? .. and specifically how to create my own customized header?
Or perhaps… write in some action hooks at key spots?
Thanks!
December 2, 2014 at 7:24 am #19009Theme Horse Support TeamKeymasterHi spectrum_7,
This is a simple example to unhook the functions. This hook is for page 404.php but you do the same way to unhook the functions for header-extension.phpunhook functions // Unhook default Thematic functions function unhook_thematic_functions() { // Don't forget the position number if the original function has one remove_action( 'attitude_404_content', 'attitude_display_404_page_content', 10 ); } add_action('init','unhook_thematic_functions'); // removes the header content by using hook attitude_header add_action( 'attitude_404_content', 'attitude_child_display_404_page_content', 10 ); /** * function to show the footer info, copyright information */ function attitude_child_display_404_page_content() { ?> <div id="content"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', 'attitude' ); ?></h1> </header> <div class="entry-content clearfix" > <p>Thank you</p> </div><!-- .entry-content --> </div><!-- #content --> <?php }
If you are unable to unhook the functions then you need to hire a developer to fix the issue.
Thank you!
December 2, 2014 at 3:56 pm #19022spectrum_7ParticipantOkay, thanks.
I had the priority wrong on my unhook function….
And… I was hoping there was a simpler way than adding and hooking the 800+ lines of code from interface_headercontent_details() into my functions.php.
Here’s the unhook:
`//Remove the original headercontenct_details
function remove_interface_header_details() {
remove_action( ‘interface_header’, ‘interface_headercontent_details’, 10 );
}
add_action(‘interface_header’,’remove_interface_header_details’ , 9 );//here’s the custom hook
add_action( ‘interface_header’, ‘my_interface_headercontent_details’, 10 );
function my_interface_headercontent_details() { THE FUNCTION GOES HERE }’December 3, 2014 at 4:52 am #19031Theme Horse Support TeamKeymasterIs it working now spectrum_7 ?
Thank you!
December 3, 2014 at 5:13 am #19034spectrum_7ParticipantYes it is.
Cheers
December 3, 2014 at 5:16 am #19035Theme Horse Support TeamKeymasterOk that’s great spectrum_7
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.