2021年4月25日星期日

Parent (functions.php) executes but actions doesn't seem to work

I'm reading this WordPress Theme flow chart.

wordpress theme flow chart

I've setup a basic parent/child themes in my wordpress.

Child Theme (functions.php)

<?php     echo "child theme";  

Parent Theme (functions.php)

<?php     echo "top";    function coffee_enqueue_styles() {      echo "parent theme";  }    add_action('wp_enqueue_scripts', 'coffee_enqueue_styles');    echo "bottom";  

So after I activated my child theme and it loads and executes it's functions.php file and print child theme. Then WordPress checks if this theme has a parent, it executes it's functions.php file and in my case it does and prints top and bottom but for some reason it doesn't executes the add_action hook where I'm printing enqueued from parent.

This is the output I get.

output of my child-parent theme execution

Am I missing something? Please guide me. Thanks you.

https://stackoverflow.com/questions/67255914/parent-functions-php-executes-but-actions-doesnt-seem-to-work April 26, 2021 at 12:47AM

没有评论:

发表评论