- This topic has 7 replies, 4 voices, and was last updated 8 years, 1 month ago by Theme Horse Support Team.
-
AuthorPosts
-
August 10, 2015 at 5:10 am #27120ed1996Participant
Hi,
I am trying to modify the theme’s header-extensions.php file. I know that I should create a child theme to do so, and I have followed the instructions on the Theme Horse forum.
In my child theme, the stylesheet.css file is working fine. I created a copy of header-extensions.php and located it in Interface-child/structure/inc/header-extensions.php. My child functions.php file only contains the following code:
<?php function unhook_thematic_functions(){ remove_action('interface_init', 'interface_load_files', 15); } add_action('init', 'unhook_thematic_functions'); add_action( 'interface_init', 'interface_child_load_files', 15 ); function interface_child_load_files() { /** * interface_add_files hook * * Adding other addtional files if needed. */ do_action( 'interface_add_files' ); /** Load functions */ require_once( INTERFACE_FUNCTIONS_DIR . '/i18n.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/custom-header.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/functions.php' ); require_once( INTERFACE_FUNCTIONS_DIR . '/custom-style.php' ); require_once( INTERFACE_ADMIN_DIR . '/interface-themedefaults-value.php' ); require_once( INTERFACE_ADMIN_DIR . '/theme-option.php' ); require_once( INTERFACE_ADMIN_DIR . '/interface-metaboxes.php' ); /** Load Shortcodes */ require_once( INTERFACE_SHORTCODES_DIR . '/interface-footer_info.php' ); /** Load Structure */ require_once( INTERFACE_STRUCTURE_DIR . '/header-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/searchform-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/sidebar-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/footer-extensions.php' ); require_once( INTERFACE_STRUCTURE_DIR . '/content-extensions.php' ); /** Load Widgets and Widgetized Area */ require_once( INTERFACE_WIDGETS_DIR . '/interface_widgets.php' ); } ?>
However, modifications to the header-extensions.php files in the child theme directory do not apply to my website. My guess is that I need to change the address in the
require_once( INTERFACE_STRUCTURE_DIR . '/header-extensions.php' );
line.Any help is appreciated, thank you very much.
August 24, 2015 at 1:26 pm #27615MarkParticipantCould support team on this forum answer this question, please? I’m wondering the same, how does one make changes in header-extensions.php in a child theme?
August 25, 2015 at 5:23 am #27641Theme Horse Support TeamKeymasterHi all,
Creating the same structure in the child theme will not over ride the parent theme. First of all you need to unhook the function and then customize the code. We will post a simple example how to unhook to functions:-
Create a two files styles.css and functions.phpUnder style.css add this following code.
/* Theme Name: interface Child Theme Author: Self-Help WordPress User Template: interface */ @import url("../interface/style.css");
Under functions.php file
unhook functions
// Unhook default Thematic functions function unhook_thematic_functions() { // Don't forget the position number if the original function has one remove_action( ‘interface_404_content', ‘interface_display_404_page_content', 10 ); } add_action('init','unhook_thematic_functions'); // removes the header content by using hook interface_header add_action( ‘interface_404_content', ‘interface_child_display_404_page_content', 10 ); /** * function to show the footer info, copyright information */ function interface_child_display_404_page_content() { ?> <div id="content"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Error 404-Page NOT Found', ‘interface’ ); ?></h1> </header> <div class="entry-content clearfix" > <p>Thank you</p> </div><!-- .entry-content --> </div><!-- #content --> <?php }
If you are still unable to fix it then you need to hire a developer to fix it.
Thank you!
August 25, 2015 at 8:26 am #27660MarkParticipantThank you for answering.
Is this how to get header-extensions.php in a child theme to work or is example made on something else? It doesn’t seem to work for my problem. I have created child style sheet months ago and it’s working fine.
August 25, 2015 at 10:33 pm #27692ed1996ParticipantHi Mark,
I’ve managed to get my child header-extensions.php to work. I’m an extremely novice programmer, so there probably is a better solution out there. However, I’ll post the code that I’m using and provide an explanation.
<?php function unhook_thematic_functions(){ remove_action('interface_init', 'interface_constants', 10); } add_action('init', 'unhook_thematic_functions'); add_action( 'interface_init', 'interface_child_constants', 10 ); function interface_child_constants() { /** Define Directory Location Constants */ define( 'INTERFACE_PARENT_DIR', get_template_directory() ); define( 'INTERFACE_CHILD_DIR', get_stylesheet_directory() ); define( 'INTERFACE_IMAGES_DIR', INTERFACE_PARENT_DIR . '/images' ); define( 'INTERFACE_INC_DIR', INTERFACE_CHILD_DIR. '/inc' ); define( 'INTERFACE_PARENT_CSS_DIR', INTERFACE_PARENT_DIR. '/css' ); define( 'INTERFACE_ADMIN_DIR', INTERFACE_INC_DIR . '/admin' ); define( 'INTERFACE_ADMIN_IMAGES_DIR', INTERFACE_ADMIN_DIR . '/images' ); define( 'INTERFACE_ADMIN_JS_DIR', INTERFACE_ADMIN_DIR . '/js' ); define( 'INTERFACE_ADMIN_CSS_DIR', INTERFACE_ADMIN_DIR . '/css' ); define( 'INTERFACE_JS_DIR', INTERFACE_PARENT_DIR . '/js' ); define( 'INTERFACE_CSS_DIR', INTERFACE_PARENT_DIR . '/css' ); define( 'INTERFACE_FUNCTIONS_DIR', INTERFACE_INC_DIR . '/functions' ); define( 'INTERFACE_SHORTCODES_DIR', INTERFACE_INC_DIR . '/footer_info' ); define( 'INTERFACE_STRUCTURE_DIR', INTERFACE_INC_DIR . '/structure' ); if ( ! defined( 'INTERFACE_LANGUAGES_DIR' ) ) /** So we can define with a child theme */ define( 'INTERFACE_LANGUAGES_DIR', INTERFACE_PARENT_DIR . '/languages' ); define( 'INTERFACE_WIDGETS_DIR', INTERFACE_INC_DIR . '/widgets' ); /** Define URL Location Constants */ define( 'INTERFACE_PARENT_URL', get_template_directory_uri() ); define( 'INTERFACE_CHILD_URL', get_stylesheet_directory_uri() ); define( 'INTERFACE_IMAGES_URL', INTERFACE_PARENT_URL . '/images' ); define( 'INTERFACE_INC_URL', INTERFACE_PARENT_URL . '/inc' ); define( 'INTERFACE_ADMIN_URL', INTERFACE_INC_URL . '/admin' ); define( 'INTERFACE_ADMIN_IMAGES_URL', INTERFACE_ADMIN_URL . '/images' ); define( 'INTERFACE_ADMIN_JS_URL', INTERFACE_ADMIN_URL . '/js' ); define( 'INTERFACE_ADMIN_CSS_URL', INTERFACE_ADMIN_URL . '/css' ); define( 'INTERFACE_JS_URL', INTERFACE_PARENT_URL . '/js' ); define( 'INTERFACE_CSS_URL', INTERFACE_PARENT_URL . '/css' ); define( 'INTERFACE_FUNCTIONS_URL', INTERFACE_INC_URL . '/functions' ); define( 'INTERFACE_SHORTCODES_URL', INTERFACE_INC_URL . '/footer_info' ); define( 'INTERFACE_STRUCTURE_URL', INTERFACE_INC_URL . '/structure' ); if ( ! defined( 'INTERFACE_LANGUAGES_URL' ) ) /** So we can predefine to child theme */ define( 'INTERFACE_LANGUAGES_URL', INTERFACE_PARENT_URL . '/languages' ); define( 'INTERFACE_WIDGETS_URL', INTERFACE_INC_URL . '/widgets' ); } ?>
My previous child functions.php unhooked the wrong function. In this new functions.php I’ve changed the location where the header-extensions.php filed is sourced to my child-theme directory from the parent directory.
As well as using this code, I had to create the inc directory in my child theme. I also copied the folders in the parent inc directory (admin, footer_info, functions, structures, widgets) to the child inc directory. Lastly I just replaced the original header-extensions.php with the custom one.
Let me know if you have any questions,
EdwardAugust 26, 2015 at 5:33 am #27706Theme Horse Support TeamKeymasterHi Edward,
Is your child theme working correctly? yes you are doing correct to unhook but to modify only header-extension.php i don’t think that you need to do this all.
Just to unhook header content details E.g:-// Unhook default Thematic functions function unhook_thematic_functions() { // Don't forget the position number if the original function has one add_action( 'interface_header', 'interface_headercontent_details', 10 ); } add_action('init','unhook_thematic_functions'); // removes the header content by using hook interface_header add_action( 'interface_headercontent_details', 'interface_child_headercontent_details', 10 ); funtion interface_child_headercontent_details(){ // your stuff }
Thank you!
October 13, 2016 at 9:36 pm #47563Charles KoehlerParticipantI’m trying to do the same thing. My child-theme is set up and my style.css is working just fine but below is my functions.php file. Where and what code do I add to get my child-themes header-extensions.php file to work?
<?php
if ( ! function_exists( ‘attitude_header_title’ ) ) :
/**
* Show the title in header
*
* @since Attitude Pro 1.0
*/
function attitude_header_title() {
if( is_archive() ) {
$attitude_header_title = single_cat_title( ”, FALSE );
}
elseif( is_404() ) {
$attitude_header_title = __( ‘Page NOT Found’, ‘attitude’ );
}
elseif( is_search() ) {
$attitude_header_title = __( ‘Search Results’, ‘attitude’ );
}
elseif( is_page_template() ) {
$attitude_header_title = get_the_title();
}
else {
$attitude_header_title = get_the_title();
}return $attitude_header_title;
}
endif;
?>October 14, 2016 at 11:04 am #47578Theme Horse Support TeamKeymasterHi Charles,
Doing this doesn’t work for you. Create you own topic. Don’t add your questions on others topic. First you need to unhook and then only hook the functions. Making same structure will not overwrite the parent theme. The above is for the interface and i think you have asked a questions for attitude pro.
Just try using below code
// Unhook default Thematic functions function unhook_thematic_functions() { // Don't forget the position number if the original function has one remove_action( 'attitude_header', 'attitude_headercontent_details', 10 ); } add_action('init','unhook_thematic_functions'); // removes the header content by using hook attitude_header add_action( 'attitude_headercontent_details', 'attitude_child_headercontent_details', 10 ); funtion attitude_child_headercontent_details(){ // your stuff }
If still it doesn’t work then please create your own topic. Because this topic is a years old ago. Also make clear what exactly you want to do on the theme.
Thank You
-
AuthorPosts
- You must be logged in to reply to this topic.