#23157 closed defect (bug) (invalid)
Custom header in twenty twelve theme not pluggable/filterable
Reported by: | adamrice | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | minor | Version: | 3.5 |
Component: | Bundled Theme | Keywords: | |
Focuses: | Cc: |
Description
Child themes cannot cleanly alter the header styling output from the twenty twelve theme in inc/custom-header.php
I propose a change from
function twentytwelve_header_style()
to
if ( ! function_exists( 'function twentytwelve_header_style' ) ) : function twentytwelve_header_style() ...
Change History (6)
#1
follow-up:
↓ 3
@
12 years ago
- Cc info@… added
- Resolution set to invalid
- Status changed from new to closed
#3
in reply to:
↑ 1
;
follow-up:
↓ 4
@
12 years ago
@toscho
Why does 9 work instead of 11 ?
I've been searching everywhere for the answer as to why in this particular case the priority lower than 10 (like 9 as you used in the example above) works instead of priority more than 10 like 11.
Child's function is loaded first, when there are 2 functions, 1 is from parent and 1 from child, both are hooking to the same after_setup_theme()
, the add and remove and the order of file being loaded doesn't seem right.
Is this a bug in after_setup_theme()
?
#4
in reply to:
↑ 3
;
follow-up:
↓ 5
@
12 years ago
Replying to paulwp:
Why does 9 work instead of 11 ?
When the child theme’s functions.php
is loaded the parent theme’s action is not yet bound to the hook. So you have to wait until 'after_setup_theme'
is actually called, then remove the callback registered with a lower priority. But you have to do this earlier than the callback, otherwise the callback will be done already.
No need to make this function pluggable. Just remove it in your child theme per hook, and use your own setup function then: