Tagged: a child file, function.php
- This topic has 1 reply, 2 voices, and was last updated 8 years, 10 months ago by Theme Horse Support Team.
-
AuthorPosts
-
January 13, 2016 at 11:56 pm #41313pentalogiaParticipant
Happy New Year!
I have a problem for making a child file.1. I have used a child directory for Interface Pro Version.
–> interface-pro-child
2. And I have made some child files.
–> head.php and style.css
–> Its no problem.
3. But I couldn’t make a child file for Function.php.
4. If I uploaded the file as a child file in the child directory,
—> I couldn’t load my homepage.
—-> Fatal error: Cannot redeclare interface_setup() (previously declared in /home/hosting_users/mimoonchurch/www/wp-content/themes/interface-pro-child/functions.php:19) in /home/hosting_users/mimoonchurch/www/wp-content/themes/interface-pro/functions.php on line 23.5. This problem of error code also occurred even if I never modified the file Function.php.
(I mean that occurred the error only making a child file without modifying Function.php.)6. Can’t I make a child file for function.php?
…Must only to access the original file?January 14, 2016 at 10:55 am #41327Theme Horse Support TeamKeymasterHi pentalogia,
If there is a function used previously in parent theme then you cannot redeclare the same function name on your child theme. To make a work first unhook the functions (original) and then only customize the code in your functions.php. You can view this below link how to unhook the functions.
Below is just an example to unhook page 404.php . paste below code under funtions.php and it will overwrite page 404.php. Similarly you can do this for other functions too.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 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 }
Thank you!
-
AuthorPosts
- You must be logged in to reply to this topic.