0

Changes in .php files within a child theme are not applied on my front-end site.

I've activated a WordPress Child Theme called "Grow Child" from parent "Grow".

I want to change the footer text and links on my site, so, following the instructions, I've copied footer.php file (actually named 04.footer.php) from parent directory to the child-theme folder. I made the corrections but they are not applied to my site. What is wrong?

When I've made the same corrections directly in the parent directory, they were well applied to my site.

I use the following code in the functions.php of the child theme:

<?php
add_action( 'wp_enqueue_scripts', 'grow_child_enqueue_styles' );
function grow_child_enqueue_styles() {

    $parent_style = 'grow'; // This is 'grow-style' for the grow theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'grow-child',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}
?>

I'd like to make changes of parent theme files in my child theme folder so that when the theme is updated not to lose the changes.

Plamen
  • 11
  • 5
  • why have you renamed the footer.php file? the footer.php in the child theme must have the same name as in the parent theme! – Tobias Apr 12 '19 at 22:25
  • Make sure the `04.footer.php` file's directory structure exactly matches the parent, and copy the actual `footer.php` file of the parent into the child theme as well. – Mohandes Apr 13 '19 at 05:49
  • Yes, I copied and past and modified the same file 04.footer.php and crteated the same directory in my child theme. I also copied the other file footer.php which is in the root parent directory. Nothing happens. Interestingly, when I modified the footer.php, the corrections applied on my site but the modification of 04.footer are not applied and the text I want to correct is exactly in 04.footer.php. – Plamen Apr 13 '19 at 15:35
  • You can only modify the footer.php inside your child theme. And, wordpress will not read the 04.footer.php! – Mel Apr 14 '19 at 05:01
  • Why wordpress read 04.footer.php in the parent directory and not read the same file in the child directory? – Plamen Apr 14 '19 at 08:30

0 Answers0