pross
1
add_action( 'fl_builder_before_render_module', function( $module ) {
if ( $module instanceof FLPhotoModule ) {
if ( ! empty( $module->settings->photo_src ) ) {
$output = '';
$parts = array(
'@context' => 'https://schema.org/',
'@type' => 'ImageObject',
'contentUrl' => $module->settings->photo_src,
'license' => 'https://example.com/license',
'acquireLicensePage' => 'https://example.com/how-to-use-my-images',
);
// output this
$output .= '<script type="application/ld+json">[{';
foreach ( $parts as $type => $value ) {
$output .= sprintf( '"%s": "%s",', $type, $value );
}
$output = rtrim( $output, ',' ) . '}]</script>';
echo $output;
}
}
});