1
votes

I'm starting learning Wordpress development, and I'm stuck trying to create a child theme. Below I enumerate the steps I followed to see if someone can help me:

  1. Create a folder under 'wp-contents/themes' called 'shoptest'
  2. Inside, I've created a file 'style.css' with the following content:

    /* Theme Name: Shoptest Theme URI: http://www.testsite.com Description: Shop Isle child theme Author: Felip Template: shop-isle Version: 1.0.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready Text Domain: shop-isle */

  3. I created a file 'functions.php' with the following:

  4. I've activated the theme in Wordpress dashboard

  5. I've created a couple of folders 'inc/structure' and copied the file original 'inc/structure/footer.php' inside. So:
    • The original file is: 'wp-content/themes/shop-isle/inc/structure/footer.php'
    • The child file is: 'wp-content/themes/shoptest/inc/structure/footer.php'

In theory, if I change/add something in the child file, the webpage should reflect that change, right? I've tried but it does nothing. Just for testing, if I change anything on the original footer.php file, it's immediately changed in the website.

What am I doing wrong?

1

1 Answers

0
votes

Wordpress doesn't work this way as you think.

You should write your changes as a function and put it in functions.php of your child theme. Then use the wp_footer hook to hook your changes to the footer.

like below

function my_custom_changes() {
    // add your code
}

add_action('wp_footer', 'my_custom_changes' );