@vectrus
For example you have a ‘Custom Field’ with the ‘Image’ type and ‘Field Name’ is ‘custom_image’.
You can overwrite the template of ‘Custom Field’ block to display this image. Follow these steps:
1. Copy file
\wp-content\plugins\getwid\includes\templates\template-parts\post-custom-field.php
to
\wp-content\themes\%your-theme-name%\getwid\template-parts\post-custom-field.php
where %your-theme-name% is your theme name.
2. Open post-custom-field.php in the text editor and replace it with the code below. Change ‘custom_image’ with you own ‘Field Name’. Save.
<?php
//extract styles & classes
extract($extra_attr);
// replace custom_image with your ACF 'Field Name'
if ( !empty( $attributes['customField'] ) && $attributes['customField'] === 'custom_image' ) {
$custom_image_src = '';
$custom_image_id = get_post_meta( get_the_ID(), esc_attr($attributes['customField']), true );
$custom_image_attributes = wp_get_attachment_image_src($custom_image_id);
if ($custom_image_attributes) {
?>
<div class="<?php echo esc_attr( $wrapper_class ); ?>" <?php echo (!empty($wrapper_style) ? 'style="'.esc_attr($wrapper_style).'"' : '');?>>
<img src="<?php echo $custom_image_attributes[0]; ?>" width="<?php echo $custom_image_attributes[1]; ?>" height="<?php echo $custom_image_attributes[2]; ?>" />
</div><?php
}
} else {
?>
<div class="<?php echo esc_attr( $wrapper_class ); ?>" <?php echo (!empty($wrapper_style) ? 'style="'.esc_attr($wrapper_style).'"' : '');?>>
<?php echo (!empty($attributes['customField']) ? get_post_meta(get_the_ID(), esc_attr($attributes['customField']), true) : ''); ?>
</div>
<?php }