My View widgets are not showing up on my Divi theme

If your theme uses Divi and your View widgets don't show when you embed the View on a page using the GravityView block or [gravityview] shortcode, a conflict is happening.

Divi has a setting called "Grab the first post image," which prevents GravityView widgets from displaying.

Add the function below to your theme's functions.php file to resolve that conflict:

/** 
 * 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;
} );

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us