• Hi,
    On the line 159 of the file /inc/fotography-functions.php, the WP_Category_Checkboxes_Control class is defined without checking if the class is already defined in the child theme or not. I’m trying to override this particular class in my child theme which will obviously break the whole thing.

    Would the developers be kind enough and add an if (! class_exists(...) ) before defining this class (and possibily other classes) in the future versions?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi there,

    If you would like to make changes on the theme using child theme then you can do this, the WordPress will first check the child theme for modification and then only in Parent theme.

    Thanks.

    Thread Starter tuxitop

    (@tuxitop)

    Hello again and thank you for answering.
    I have tried to define WP_Category_Checkboxes_Control class in my functions.php file, wordpress first defines my class and the goes on to the parent theme and when it reaches to the same class in the parent theme, it gives an error because this class is already defined (in the child theme), and it breaks the website. The only way to fix this as I know, is to remove the class definition in the parent theme or add a line to check if the class is already defined and skip the definition if so.
    I don’t know how else would I define the class before the parent theme.

    Hi there,

    The function WP_Category_Checkboxes_Control
    is defined on the theme folder inc/fotography-functions.php
    the best solution is to make same folder structure and copy the same file to your child theme and edit this file.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using a child theme to override classes’ is closed to new replies.