Last active
July 22, 2017 07:17
-
-
Save hisnipes/7476902 to your computer and use it in GitHub Desktop.
The correct way to override a Wordpress parent theme function in functions.php through a child theme.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#-----------------------------------------------------------------# | |
# Example: load revised tinymce file in child theme folder | |
#-----------------------------------------------------------------# | |
add_action( 'after_setup_theme', 'new_function_setup' ); | |
function new_function_setup() { | |
remove_action('init', 'old_function_init'); | |
function new_function_init() { | |
if(is_admin()){ | |
if(is_edit_page()){ | |
require_once ( 'child_theme_folder/new_file.php' ); | |
} | |
} | |
} | |
add_action('init', 'new_function_init'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment