Filter to add a “child plugin” to change the Plugins template files?
-
Hello ??
The last days I’m trying to switch from Elementor to Oxygen as page builder because oxygen delivers much cleaner code then Elementor does. At the moment I’m overriding a template of your plugin in my themes folder (as it’s normal for probably all plugins which does have that feature).The Problem is… That Oxygen disables the WordPress themes completely. So I’m not able to edit the plugin templates in my themes folder.
In WooCommerce there is a filter where you can hook into the “woocommerce_locate_template” and add for example a plugin path where you can locate the plugin templates instead of the standard theme path. (yourtheme/customer-reviews-woocommerce/)
I’ve searched a bit through your code but sadly I wasn’t able to find the right place, where you add the “check” for your plugin templates (something like the locate_template function from WordPress or anything like that)
Or are you adding it here:public function load_custom_comments_template( $template ) { if ( get_post_type() !== 'product' ) { return $template; } $plugin_folder = 'customer-reviews-woocommerce'; $check_dirs = array( trailingslashit( get_stylesheet_directory() ) . $plugin_folder, trailingslashit( get_template_directory() ) . $plugin_folder ); $template_file_name = 'ivole-single-product-reviews.php'; if( 'yes' === $this->ivole_ajax_reviews ) { $template_file_name = 'cr-ajax-product-reviews.php'; } foreach ( $check_dirs as $dir ) { if ( file_exists( trailingslashit( $dir ) . $template_file_name ) ) { return trailingslashit( $dir ) . $template_file_name; } } return wc_locate_template( $template_file_name, '', plugin_dir_path ( __FILE__ ) . '/templates/' ); }
Is there probably any hook where I can add this like with WooCommerce?
Best,
Justus
- The topic ‘Filter to add a “child plugin” to change the Plugins template files?’ is closed to new replies.