Child Theme – Overwrite parent function
-
Hi I want to overwrite a function in the parent theme.
Parent Theme (esplanade)
I have created a child theme, but cannot make the overwrite function work.
I know that the child function.php is loaded first, and there for should by able to overwrite the parent function just by declaring in the child theme, if the function_exists() is use in the parent theme, which it is in this case.Child Theme (esplanade-child)
# child theme function.php if ( ! function_exists( 'child_esplanade_theme_setup' ) ) : function child_esplanade_theme_setup() { /* do some thing*/ } function remove_parent_esplanade_theme_setup() { remove_action( 'after_setup_theme', 'esplanade_theme_setup' ); add_action( 'after_setup_theme', 'child_esplanade_theme_setup' ); } add_action( 'after_setup_theme', 'remove_parent_esplanade_theme_setup' );
Can anyone explain to me why this won’t work. I have tryed other thing as well.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Child Theme – Overwrite parent function’ is closed to new replies.