Reputation: 1625
It may be a silly question, but I cant understand how I can access every function (from functions.php for example) in WordPress without any include
or require
calls, I know if I want to create a new script I can simply require wp-load.php
from that particular script, just dont understand why this is isn't needed in other template files.
Upvotes: 0
Views: 190
Reputation:
WordPress does that automatically. Whenever there is a functions.php file for the active theme, WP will load it for you. The magic happens in wp-settings.php, specifically among the following lines:
if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
include( STYLESHEETPATH . '/functions.php' );
if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
include( TEMPLATEPATH . '/functions.php' );
}
Upvotes: 1