• be165

    (@be165)


    I’m trying to learn how to modify a theme using a child-theme. The site I am building is using the free ColorMag theme.

    I understand that you can override a parent theme function in the child-theme functions.php file by calling the same function name as long as the function in the parent theme is hookable. i.e., starts with: if ( ! function_exists ( 'my_function' ) ) {

    Otherwise, it is usually possible to just copy the file I want to change into the child-theme and make the modifications there.

    My problem is that I’m trying to change the output of a widget built into the ColorMag theme. The file creating the output is located in inc/widgets/widgets.php. Copying the folder structure and file name doesn’t load, and the function isn’t hookable.

    The specific output I’m wanting to change is listed under:
    class colormag_featured_posts_widget extends WP_Widget {

    What would be the best practice way to do this without making the change in the parent theme directly?

    Thanks.

  • The topic ‘Best practice way to change output of unhookable functions within child theme’ is closed to new replies.