The basic theme – in fact every theme I’ve looked at – uses get_header() to include the header file, but I don’t see any reason for doing so.
What’s are the advantages of using get_header()
instead of a simple include('file.php')
?
The basic theme – in fact every theme I’ve looked at – uses get_header() to include the header file, but I don’t see any reason for doing so.
What’s are the advantages of using get_header()
instead of a simple include('file.php')
?
Using generic function means throwing out layer of WP API:
get_header
hook would be gone;"header-{$name}.php"
) would be gone;locate_template()
would be gone, which likely would destroy compatibility with child themes.You can always look at source to see what exactly function does.
WordPress uses own function not just-because. It is usually for concrete compatibility or functionality reasons.