Bug: Doesn’t include ‘gdpr-modules’ template from child theme
-
Hi,
The ‘gdpr-modules’ folder can be copied/moved into your theme folder and modified to override the default plugin templates.
That’s all good, but if you use a child theme and move the ‘gdpr-modules’ folder into your child theme, it fails and doesn’t display anything.
This is because ‘moove-modules-view.php’ uses ‘locate_template()’ and ‘get_template_directory()’. It checks if the template file exists in either the parent or child theme, but then ASSUMES that it is in the parent theme.
A quick and dirty re-write of the ‘load()’ function to fix this problem:
public static function load( $view, $content ) { $view_name = 'gdpr-modules' . DIRECTORY_SEPARATOR . str_replace( '.' , DIRECTORY_SEPARATOR , $view ) . '.php'; $view_file_plugin = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . $view_name; $view_file_theme = locate_template( $view_name ); ob_start(); if ( file_exists( $view_file_theme ) && is_readable( $view_file_theme ) ) { include $view_file_theme; } else if ( file_exists( $view_file_plugin ) && is_readable( $view_file_plugin ) ) { include $view_file_plugin; } return ob_get_clean(); }
The topic ‘Bug: Doesn’t include ‘gdpr-modules’ template from child theme’ is closed to new replies.