name = 'image'; $this->label = 'Image'; $this->category = 'content'; } public function render( $field, $value = '', $name = null ) { $name = $name ?: "metaforge[{$field['name']}]"; $attachment_id = ! empty( $value ) ? intval( $value ) : ''; // Fetch 'medium' size instead of 'thumbnail' to prevent WP from hard-cropping logos/banners $image_url = $attachment_id ? wp_get_attachment_image_url( $attachment_id, 'large' ) : ''; // Fallback to full size if medium isn't generated (e.g. for small logo files) if ( $attachment_id && ! $image_url ) { $image_url = wp_get_attachment_url( $attachment_id ); } $has_image = ! empty( $image_url ); echo '