Check if DIVI is running (Theme Template Fix)
-
Hello!
I know it’s mentioned that your plugin supports Divi, however, it’s only checking to see if Divi is being used on a product, not if a product is using a Divi Theme template.
In your “Divi check” in the file: smart-variations-images\public\class-smart-variations-images-public.php on line 1095, there’s a function called “validate_runningDivi“.
In there you’re just checking the product content for Divi content, but you should also be checking to see if the product is being displayed through a Divi Theme Template.
Like this…
public function validate_runningDivi( $product ) { $post_content = get_post( $product->get_id() ); $content = $post_content->post_content; $pos = strpos( $content, 'et_pb_wc_images' ); $pos2 = strpos( $content, 'et_pb_wc_gallery' ); if ( $pos !== false || $pos2 !== false ) { return true; } // Double checking to see if maybe there is one in a template piece of Divi's... if ( class_exists( 'ET_Theme_Builder_Request' ) ) { $tb_layouts = et_theme_builder_get_template_layouts( ET_Theme_Builder_Request::from_post( $product->get_id() ) ); // Is this a template that overrides the page? (Only check PAGE templates, not header or footer.) if ( !empty( $tb_layouts ) && $tb_layouts[ ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE ]['override'] ) { $templateContent = get_the_content( null, false, $tb_layouts[ ET_THEME_BUILDER_BODY_LAYOUT_POST_TYPE ]['id'] ); $pos = strpos( $templateContent, 'et_pb_wc_images' ); $pos2 = strpos( $templateContent, 'et_pb_wc_gallery' ); if ( $pos !== false || $pos2 !== false ) { return true; } } } return false; }
Could you please add this fix to your plugin? This will help my own client in the future when there’s an update to your plugin. Thanks!
- The topic ‘Check if DIVI is running (Theme Template Fix)’ is closed to new replies.