Child theme files from inc folder
-
Hello,
I know that files from inc folder can’t be change in child theme like files from other theme folders, it’s only can modify in child theme functions.php.
I want to change inc/widgets/class-widget-layered-nav.php file…
I copied whole class in my child theme functions.php :
if ( ! class_exists( ‘WOODMART_Widget_Layered_Nav’ ) ) {
class WOODMART_Widget_Layered_Nav extends WPH_Widget {
….
} // class
}
But I got error Fatal error: Class ‘WPH_Widget’ not found in /app/public/wp-content/themes/woodmart-idc/functions.php on line
Can you give me a hint how to modify inc files in child theme?
Kind regards
I changed this function:
protected function layered_nav_dropdown( $terms, $taxonomy, $query_type ) {
}
Hi,
If you want to override the widget PHP Class you need to place a code from the file inc/third-party/wph-widget-class.php
before the widget code.
Regards
Thank you!!!Works perfect!!!
Can I do the same thing for js/functions.js file?
Is it maybe a problem beacause functions.js create functions.min.js?
Kind regards
Sorry, but there is no way to override JS file in the child theme in WordPress as well as PHP files.