#23157 closed defect (bug) (invalid)
Custom header in twenty twelve theme not pluggable/filterable
| Reported by: | adamrice | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Bundled Theme | Version: | 3.5 |
| Severity: | minor | Keywords: | |
| Cc: | Focuses: |
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)
#3
in reply to: ↑ 1
;
follow-up:
↓ 4
@
14 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
@
14 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
No need to make this function pluggable. Just remove it in your child theme per hook, and use your own setup function then:
add_action( 'after_setup_theme', 'disable_parent_custom_header', 9 ); function disable_parent_custom_header() { remove_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' ); }