Hi all, I am new on PHP. I try to understand how a function works. I just wonder how a script knows where is function specified file? For example, wordpress, header.php (wordpress\wp-content\themes\twentyten) has a function body_class() but this function is specified in different file on different root( wp-includes/post-template.php. ) So, my question is, how body_class() knows it's specified code is in post-template.php?
If the function definition is in a different file, then that file has to be [man]include/man-ed or [man]require/man-ed into the current script.
NogDog;10980633 wrote:If the function definition is in a different file, then that file has to be [man]include/man-ed or [man]require/man-ed into the current script.
Thanks for your reply but in the case of wordpress it doesn't always use include() and require() function.
look in /wp-includes/theme.php
there is a function load_template() that does the require/require_once
look in /wp-includes/general-template.php
there is a get_header() function that locates the header template and loads it with load_template