badget

Biggest Sale! Special Offer!

Get 30% discount on all of our single themes with this coupon code: #30%SALE

Hurry up! *Limited time offer*

How to add an additional div in the header?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #18990
    spectrum_7
    Participant

    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!

    #19009

    Hi 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.php

    unhook 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!

    #19022
    spectrum_7
    Participant

    Okay, 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 }’

    #19031

    Is it working now spectrum_7 ?

    Thank you!

    #19034
    spectrum_7
    Participant

    Yes it is.

    Cheers

    #19035

    Ok that’s great spectrum_7

    Thank you!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.