Skip to content

Commit 7d1c469

Browse files
preda-bogdanselul
authored andcommitted
fix: improve compatibility with Divi builder
1 parent bf9f058 commit 7d1c469

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

inc/compatibilities/divi_builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function ( $all_watchers ) {
3030
$all_watchers[] = '.et_pb_slides > .et_pb_slide';
3131
$all_watchers[] = '.et_parallax_bg';
3232
$all_watchers[] = '.et_pb_video_overlay';
33-
$all_watchers[] = '.et_pb_module';
33+
$all_watchers[] = '.et_pb_module:not(.et_pb_blog_grid_wrapper)';
3434
$all_watchers[] = '.et_pb_row';
3535
$all_watchers[] = '.et_pb_with_background';
3636
return $all_watchers;

inc/conflicts/divi.php

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
3+
/**
4+
* Class Optml_Divi
5+
*
6+
* An example of a conflict.
7+
*/
8+
class Optml_Divi extends Optml_abstract_conflict {
9+
10+
/**
11+
* Optml_Divi constructor.
12+
*/
13+
public function __construct() {
14+
$this->priority = 2;
15+
$this->severity = self::SEVERITY_HIGH;
16+
parent::__construct();
17+
}
18+
19+
/**
20+
* Set the message property
21+
*
22+
* @since 2.2.6
23+
* @access public
24+
*/
25+
public function define_message() {
26+
$this->message = sprintf( __( 'It seems your are using %1$sDivi%2$s right now. %3$s In order for Optimole to replace the images in your Divi pages, you will need to go to %4$sDivi -> Theme Options -> Builder -> Advanced -> Static CSS File Generations%5$s and click on Clear for the images to be processed. ', 'optimole-wp' ), '<b>', '</b>', '<br/>', '<a target="_blank" href="' . admin_url( 'admin.php?page=et_divi_options' ) . '">', '</a>' );
27+
}
28+
29+
30+
/**
31+
* Determine if conflict is applicable.
32+
*
33+
* @return bool
34+
* @since 2.2.6
35+
* @access public
36+
*/
37+
public function is_conflict_valid() {
38+
$show_message = false;
39+
$theme = wp_get_theme( 'Divi' );
40+
if ( $theme->exists() && strcmp( $theme->get( 'Name' ), 'Divi' ) === 0 ) {
41+
$show_message = true;
42+
}
43+
44+
if ( is_plugin_active( 'divi-builder/divi-builder.php' ) ) {
45+
$show_message = true;
46+
}
47+
if ( get_template_directory() !== get_stylesheet_directory() && strcmp( wp_get_theme( get_template() )->get( 'Author' ), 'Divi' ) === 0 ) {
48+
$show_message = true;
49+
}
50+
51+
if ( ! function_exists( 'et_get_option' ) ) {
52+
return false;
53+
}
54+
if ( 'off' === et_get_option( 'et_pb_static_css_file', 'on' ) ) {
55+
return false;
56+
}
57+
58+
return $show_message;
59+
}
60+
}

inc/main.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public static function register_conflicts( $conflicts_to_register = array() ) {
9797
'Optml_Jetpack_Photon',
9898
'Optml_Jetpack_Lazyload',
9999
'Optml_Wprocket',
100+
'Optml_Divi',
100101
)
101102
);
102103

0 commit comments

Comments
 (0)