can the footer be included on a child theme

admin2025-01-07  6

If the footer can be included, what must be written on the child theme footer.php page to get it started. I should say I am new to child themes and have already shut the site down by including the entire parent stylesheet/functions.php. After reading about that same rookie issue that another member experienced I immediately went to cPanel to delete it.

However before I upload my updated child theme, I'll wait for an answer concerning the footer.php. Of course I would like to edit it on my child theme to remove the WordPress branding only once.

If the footer can be included, what must be written on the child theme footer.php page to get it started. I should say I am new to child themes and have already shut the site down by including the entire parent stylesheet/functions.php. After reading about that same rookie issue that another member experienced I immediately went to cPanel to delete it.

However before I upload my updated child theme, I'll wait for an answer concerning the footer.php. Of course I would like to edit it on my child theme to remove the WordPress branding only once.

Share Improve this question edited Oct 24, 2017 at 6:50 Max Yudin 6,3782 gold badges26 silver badges36 bronze badges asked Oct 12, 2017 at 1:29 GaryGary 133 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 1

Take the whole footer.php from the parent theme and copy it to your child theme. Your child theme will override the parent footer now. Any changes you make to that footer file in the child theme (ie removing branding) will affect the site.

This is usually better than starting with a whole new footer.php especially if the theme you are using is overly complex.

As for the style.css and functions.php. Sorry you had to go through that mess!

The only things your footer.php needs is the wp_footer() function and any html closing tags your theme requires e.g. </body> </html>.

If would just like to remove some stuff from your parent theme I would recommend you just duplicate that file and remove what you don't want.

Child themes are loaded before the parent, so you will need to define the class inside a hook that runs after the parent theme has loaded, so that the parent theme class exists to be extended. after_setup_theme would be the logical choice.

function mytheme_includes() {
    require_once get_theme_file_path( 'includes/footer.php' );
}
add_action( 'after_setup_theme', 'mytheme_includes' );

As other users already mentioned, your footer.php file should basically be a copy of the parent file of the same name, with the modification you want to bring to it.

This will overwrite the footer.php file of the parent.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736256354a354.html

最新回复(0)