Site logo

Archived topic

Fallback image for dynamic image

9 replies · Started by Kees on October 5, 2022

Viewing posts 1–10 of 10

Hi,

i have a generatpress element that i hook before the footer on a page. I have a dynamic image with ACF. How do i set a fallback image?
I prefer not to use a background image.

Hey Kees,

If you is using the GenerateBlocks image block, you can use this filter to define a fallback image:

add_filter( 'generateblocks_dynamic_image_fallback', function( $url ) {
	if ( ! $url ) {
		return 'https://picsum.photos/480';
	}

	return $url;
}, 10, 1 );

Hi,

This does not work. It does not show anything. Can you have another look?

See video. Element with a hook and a custom field.

That link keeps returning: Sorry! Something went wrong on our end. Can you recheck the Loom file ?

And now?

Hi,

That is not an option because i have a custom field with acf. And i cant select it there.

In the GB Image Block you can enable its Dynamic Data and set the Data Type to: Post Meta, then add your ACF name in the field provided.

This archived topic is closed to new replies.