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*

Reply To: How to add a secondary menu to Attitude Pro WordPress theme?

#2901
Sanjip Shah
Participant

@jnasevich Only the template files like header.php, index.php, archive.php etc created in the child theme will replace the same file of the parent theme. But creating the functional files like header-extensions.php with same same path in the child theme will not overwrite the parent function. There is other way for this. To learn about how the functions of parent theme are unhooked from an action hook and how a function from child theme is added to action hook you can visit this link http://themeshaper.com/2009/05/25/action-hooks-wordpress-child-themes/. Below is an example of how its done. Put this code in the functions.php file of the child theme.
add_action( ‘init’, ‘attitude_remove_parent_function’ );

/**
* Removes parent function attached to hook
*/
function attitude_remove_parent_function(){
remove_action( ‘attitude_header’, ‘attitude_headerdetails’, 10 );
}

add_action( ‘attitude_header’, ‘attitude_child_headerdetails’, 10 );
/**
* Add your custom function
*/
function attitude_child_headerdetails() {
// Copy all the content inside the attitude_headerdetails function of parent theme, paste here and make necessary changes here.
}

Hope this helps you.