Opened 7 years ago
Closed 4 years ago
#42921 closed defect (bug) (invalid)
get_header('customheadername') is fetching the header.php even i have provided customheadername
Reported by: | mausamrai | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.9.1 |
Component: | Themes | Keywords: | reporter-feedback close |
Focuses: | template | Cc: |
Description
get_header() is not supporting the custom headername provided. so fetching default header.php
Change History (4)
#3
@
4 years ago
- Keywords close added
Hello @mausamrai,
Does this problem still persist for you today?
If yes, does a template file exist for the custom header, i.e. a file named: header-customheadername.php
?
How does this work?
WordPress will load custom header templates when the header-{template name}.php
file exists; else, the default template is loaded.
You can find more information here https://developer.wordpress.org/reference/functions/get_header/.
As @ Compute notes, I too suspect the problem is due to a mismatch of the name passed to the function and the template's filename. I'm marking this ticket as a close
worksforme
candidate. Please don't be alarmed. We mark tickets for close consideration when we are unable to reproduce and suspect the problem is not due to WordPress core. However, when more information is given, we reevaluate.
What is the name of your header file? The filename should be header-{$name}.php where $name is the argument you are using in get_header().
Like
get_header( 'customheadername' )
should beheader-customheadername.php
.See: https://developer.wordpress.org/reference/functions/get_header/