How to change class method in child theme?
-
How to change the behavior of the post_tags () method in the file /inc/blog/class-post-entry.php? I created a child theme and I want to override the method. Do not want to change the code in the parent theme. The following code does not work:
function overload_method() { require_once get_template_directory() . '/inc/blog/class-post-entry.php'; if (! Class_exists ('Customify_Post_Entry')) { class Customify_Post_Entry { function post_tags() { $html = 'custom text'; echo $html; } } } } add_action( 'init', 'overload_method' );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘How to change class method in child theme?’ is closed to new replies.
