-
AuthorPosts
-
March 18th, 2013 at 15:44 #4354Paul Harrison
Hi,
I want to change some text in the theme-functions.php file on the main mantra theme, so have created a child theme which all works well however this file won’t override so no matter what changes I make to the child theme theme-function.php file it wont display.
I have put it in mantra-child->includes so it is in the same position as the main theme but it doesn’t work.
Can anyone advise?
Thanks
March 18th, 2013 at 20:25 #4372ZedCryout Creations mastermindSome functions are automatically replaced if you use the same function name in the child theme, bust most core functions are a bit more difficult to override.
You need to individually un-hook Mantra actions and hook your own modified child theme functions in their place.
Example:
// remove mantra functions action hooks
function remove_mantra_functions() {
remove_action('cryout_existing_hook', 'mantra_existing_function',[priority-if-set]);
}
add_action('init','remove_mantra_functions');
// custom child function
function child_theme_function_replacement() {
... }
// add replacement child function
add_action('cryout_existing_hook','child_theme_function-replacement',[same-priority-as-replaced-function-if-set]);If you like our creations, help us share by rating them on WordPress.org.
Please check the available documentation and search the forums before starting a topic.March 19th, 2013 at 10:56 #4407Paul HarrisonHi,
Is this done in the child version of the main template version of the file?
March 22nd, 2013 at 22:17 #4565ZedCryout Creations mastermindThis is done in the child theme’s functions.php file.
If you like our creations, help us share by rating them on WordPress.org.
Please check the available documentation and search the forums before starting a topic. -
AuthorPosts
The topic ‘Override theme-functions.php’ is closed to new replies.