-
-
Save zackkatz/e42de70d0869e0c7c148694ea59410b3 to your computer and use it in GitHub Desktop.
Prevent a Divi-powered theme from disabling GravityView's widgets when the View is embedded in a page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Prevent Divi from using the "Grab the first post image" setting. | |
* | |
* It uses et_first_image() which uses apply_filters( 'the_content' ) which causes | |
* a conflict GravityView, which uses 'the_content' filter. | |
* | |
* @param bool $setting Is the setting enabled and the request is not Buddypress? | |
* | |
* @return bool If displaying a GravityView View, false. Otherwise, the original value. | |
*/ | |
add_filter( 'et_grab_image_setting', function( $setting ) { | |
if ( function_exists( 'gravityview' ) && gravityview()->request->is_view() ) { | |
return false; | |
} | |
return $setting; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment