Overview
What It's For
The Image block is a purpose-built image placement block for the Sculptr theme. Use it to insert a single image anywhere on a page with full control over its rendered dimensions, fit behavior, visual styling, and optional link destination — all configured through the block inspector sidebar without touching any code.
When to Use It
Reach for Image instead of the core WordPress image block when you need pixel-precise control over how an image is sized and cropped within its container (for example, forcing a fixed aspect ratio or constraining height while keeping width fluid), when the image needs to link to an internal post, page, or media file chosen from a dropdown, or when you want CSS-driven hover effects or a visible "open" icon to appear on mouse-over. The core block handles basic image insertion cleanly; this block handles the cases where layout, interactivity, or visual polish demand more.
Key Capabilities
- Registered image size selection — choose which WordPress-registered size (thumbnail, medium, large, full, etc.) is served to visitors, with actual pixel dimensions shown for the selected image
- Precise dimension controls — set Max Width, Width, and Height individually in
pxor% - Object Fit and Aspect Ratio — independently control how the image fills its container (
contain,cover,none) and lock it to a preset ratio (1:1, 3:4, 4:3, 16:9, or none) - Opacity — fine-tune image transparency from 0 to 1
- Margin spacing — theme-scale margin controls (top, bottom, left, right) on the figure wrapper
- Border — set border style, width, color, and radius (global or per-corner) directly from the sidebar
- Box Shadow — choose a preset lift level or configure a fully custom shadow
- Clickable image linking — optionally make the entire image a link, pointing to an external URL or any internal post/page/media file selected from dynamic dropdowns
- Open icon overlay — when linking is enabled, optionally display an SVG "open" icon over the image with a Light or Dark theme to ensure contrast
- Hover effects — apply one or more CSS hover animations to linked images: Vertical Shift, Box Shadow, Scale Down, Scale Up
DOM Structure
<figure class="fc-image-block {open_icon_theme_class}" style="{figure_style}">
<!-- when 'Link Image' is enabled, wrapping <a> appears outside <figure> -->
<!-- when 'Link Image' is enabled and 'Display Open Icon' is enabled -->
<span class="open-icon-bg"></span>
<span class="open-icon-wrapper">
{open_svg_icon} <!-- SVG icon, color determined by 'Open Icon Theme' (light or dark) -->
</span>
<!-- end open icon -->
<img
src="{image_url}"
alt="{image_alt}"
style="
max-width: {max_width};
width: {width};
height: {height};
object-fit: {object_fit};
aspect-ratio: {aspect_ratio};
{border_styles}
{box_shadow_styles}
opacity: {opacity};
"
/>
</figure>
<!-- when 'Link Image' is enabled, full structure is wrapped as: -->
<a
href="{link_url}"
aria-label="Navigate to {link_url}"
class="wrapper {hover_effect_classes}" <!-- one or more of: v-shift, box-shadow, scale-down, scale-up; from 'Hover Effect' -->
target="_blank" <!-- only when linked post type is 'attachment' -->
>
<figure class="fc-image-block {open_icon_theme_class}" style="{figure_style}">
<!-- when 'Display Open Icon' is enabled -->
<span class="open-icon-bg"></span>
<span class="open-icon-wrapper">
{open_svg_icon}
</span>
<!-- end open icon -->
<img
src="{image_url}"
alt="{image_alt}"
style="
max-width: {max_width};
width: {width};
height: {height};
object-fit: {object_fit};
aspect-ratio: {aspect_ratio};
{border_styles}
{box_shadow_styles}
opacity: {opacity};
"
/>
</figure>
</a>
<!-- nothing rendered when no image is selected -->DOM Notes
No dynamic regions.
Technical Documentation
Canvas Controls
Image Upload
- Attribute:
image - Type: Media library picker (WordPress MediaUpload)
- Default: None (empty)
- Panel: Canvas (rendered directly in the block editor canvas, not in the inspector sidebar)
What it controls — Selects the image that appears on the front end. When no image is selected, the block displays an "+ Add Media" button. Once an image is chosen, a preview appears in the editor with a "Remove" link to clear it.
Notes — Only image file types are accepted. Removing the image returns the block to its empty state and nothing is rendered on the front end until a new image is selected.
Block Settings
Image Size
- Attribute:
imageSize - Type: Single-select dropdown
- Default:
full - Panel: Size
What it controls — Determines which registered WordPress image size (e.g. Thumbnail, Medium, Large, Full) is served to site visitors. Choosing a smaller size reduces page weight and speeds up load time.
Options — Populated dynamically from the site's registered image sizes. When the selected image has known pixel dimensions for a given size, those dimensions appear in parentheses next to the size name (e.g. "Medium (300×200)").
Notes — Only visible when the site has at least one registered image size available.
Max Width
- Attribute:
maxWidth - Type: Unit control field (accepts
%orpxvalues) - Default:
100% - Panel: Size
What it controls — Sets the CSS max-width on both the <figure> wrapper and the <img> element, capping how wide the image can grow regardless of its container. Leave blank to remove the constraint (unset).
Options — Any numeric value with a % or px unit suffix. Leave blank to default to unset.
Height
- Attribute:
height - Type: Unit control field (accepts
%orpxvalues) - Default:
auto - Panel: Size
What it controls — Sets the CSS height on both the <figure> wrapper and the <img> element. Leave blank to allow the image to size itself automatically.
Options — Any numeric value with a % or px unit suffix. Leave blank to default to auto.
Width
- Attribute:
width - Type: Unit control field (accepts
%orpxvalues) - Default:
100% - Panel: Size
What it controls — Sets the CSS width on both the <figure> wrapper and the <img> element, controlling how much horizontal space the image occupies.
Options — Any numeric value with a % or px unit suffix. Leave blank to default to auto.
Object Fit
- Attribute:
objectFit - Type: Single-select dropdown
- Default:
contain - Panel: Size
What it controls — Controls how the image fills its defined width/height box, using the CSS object-fit property. Most relevant when both a fixed width and height are set.
Options
- contain — Scales the image to fit within the box while preserving its aspect ratio; may leave empty space on the sides or top/bottom.
- cover — Scales the image to fill the box completely, cropping any overflow while preserving aspect ratio.
- none — Renders the image at its natural size with no scaling.
Aspect Ratio
- Attribute:
aspectRatio - Type: Single-select dropdown
- Default:
unset - Panel: Size
What it controls — Forces the image to a specific aspect ratio using the CSS aspect-ratio property. The image will maintain the chosen ratio regardless of the container width.
Options
- none — No aspect ratio constraint applied.
- 1:1 — Square format.
- 3:4 — Portrait format.
- 4:3 — Standard landscape format.
- 16:9 — Widescreen landscape format.
Opacity
- Attribute:
opacity - Type: Number field (step 0.01, shift-step 0.05)
- Default: None (unset)
- Panel: Style
What it controls — Sets the CSS opacity of the <img> element, making the image more or less transparent. A value of 1 is fully opaque; 0 is fully transparent.
Options — Any decimal value between 0 and 1 inclusive. Leave blank to apply no opacity override.
Spacing (Margin)
- Attribute:
spacing - Type: Custom SpacingControls panel
- Default: Inherits from theme
- Panel: Spacing
What it controls — Adds margin around the <figure> wrapper element. Because this block passes usePaddingTop, usePaddingBottom, usePaddingLeft, and usePaddingRight all as false, only the margin controls are active; padding controls are hidden.
Options — Each margin direction (Top, Bottom, Left, Right) accepts one of the following theme-scaled values:
- Inherit from theme — Uses the theme default spacing token.
- None — Sets margin to
0. - Quarter —
calc(var(--base-spacing) * 0.25) - Half —
calc(var(--base-spacing) * 0.5) - BASE —
var(--base-spacing) - Double —
calc(var(--base-spacing) * 2) - Triple —
calc(var(--base-spacing) * 3)
A "Fine Tune Margin" toggle switches between a single global margin value and individual per-side controls.
Border Style
- Attribute:
border(array) - Type: Custom BorderControls panel — single-select dropdown for style, plus conditional sub-fields
- Default: No border (
none) - Panel: Border
What it controls — Applies a border to the <img> element. Choosing any style other than "inherit" or "none" reveals additional controls for width, color, and corner radius.
Options
- inherit from theme — Uses the theme's default border definition.
- none — No border rendered.
- solid — A solid-line border.
- inset — An inset-style border.
- dashed — A dashed-line border.
Conditional Logic — Border Width, Border Color, and Border Radius controls appear only when Border Style is set to something other than "inherit" or "none".
Border Width
- Attribute:
border(array index 6) - Type: Unit control field (accepts
pxorem) - Default: Unset
- Panel: Border
What it controls — Sets the thickness of the border applied to the image.
Conditional Logic — Visible only when Border Style is set to a value other than "inherit" or "none".
Border Color
- Attribute:
border(array index 8) - Type: Color palette picker (theme colors only, no custom colors)
- Default: None
- Panel: Border
What it controls — Sets the color of the image border from the site's registered theme color palette.
Conditional Logic — Visible only when Border Style is set to a value other than "inherit" or "none".
Border Radius
- Attribute:
border(array indices 0–5) - Type: Toggle + unit control field(s) (accepts
px,%, orem) - Default: Unset
- Panel: Border
What it controls — Rounds the corners of the image. A "Fine Tune Border Radius" toggle switches between a single uniform radius applied to all four corners and individual controls for each corner (Top-Left, Top-Right, Bottom-Right, Bottom-Left).
Conditional Logic — Visible only when Border Style is set to a value other than "inherit" or "none".
Box Shadow Style
- Attribute:
boxShadow(array) - Type: Custom BoxShadowControls panel — single-select dropdown for style, plus conditional sub-fields
- Default:
inherit - Panel: Box Shadow
What it controls — Applies a drop shadow to the <img> element. Preset shadow levels are available, or "custom" exposes individual offset, blur, spread, and color controls.
Options
- inherit from theme — Uses the theme's default box-shadow definition.
- none — No shadow rendered.
- low lift — A subtle, close shadow suggesting slight elevation.
- medium lift — A moderate shadow suggesting clear elevation.
- high lift — A strong shadow suggesting significant elevation.
- custom — Exposes Horizontal Offset, Vertical Offset, Blur, Spread, and Color controls.
Conditional Logic — Horizontal Offset, Vertical Offset, Blur, Spread, and Color sub-fields appear only when Box Shadow Style is set to "custom".
Horizontal Offset
- Attribute:
boxShadow(array index 1) - Type: Unit control field (accepts
pxorem) - Default: Unset
- Panel: Box Shadow
What it controls — Shifts the shadow horizontally relative to the image. Positive values move it right; negative values move it left.
Conditional Logic — Visible only when Box Shadow Style is set to "custom".
Vertical Offset
- Attribute:
boxShadow(array index 2) - Type: Unit control field (accepts
pxorem) - Default: Unset
- Panel: Box Shadow
What it controls — Shifts the shadow vertically relative to the image. Positive values move it down; negative values move it up.
Conditional Logic — Visible only when Box Shadow Style is set to "custom".
Blur
- Attribute:
boxShadow(array index 3) - Type: Unit control field (accepts
pxorem) - Default: Unset
- Panel: Box Shadow
What it controls — Controls the softness of the shadow's edges. Larger values produce a more diffuse shadow; 0 produces a hard-edged shadow.
Conditional Logic — Visible only when Box Shadow Style is set to "custom".
Spread
- Attribute:
boxShadow(array index 4) - Type: Unit control field (accepts
pxorem) - Default: Unset
- Panel: Box Shadow
What it controls — Expands or contracts the shadow beyond the image's bounding box. Positive values grow the shadow; negative values shrink it.
Conditional Logic — Visible only when Box Shadow Style is set to "custom".
Color (Box Shadow)
- Attribute:
boxShadow(array index 5) - Type: Color palette picker (theme colors only, no custom colors)
- Default: None
- Panel: Box Shadow
What it controls — Sets the color of the custom box shadow from the site's registered theme color palette.
Conditional Logic — Visible only when Box Shadow Style is set to "custom".
Link Image
- Attribute:
linkImage - Type: Checkbox
- Default:
false - Panel: Link
What it controls — Wraps the <figure> element in an <a> tag on the front end, making the entire image clickable. When enabled, additional controls appear to configure the link destination and decorative hover behavior.
Conditional Logic — All other settings in the Link panel are hidden unless this checkbox is checked.
Link is external URL
- Attribute:
hrefIsExternal - Type: Checkbox
- Default:
false - Panel: Link
What it controls — Switches the link destination between an internal site page/post and a fully qualified external URL. When checked, the image links to the URL typed into the External URL field. When unchecked, the link is built from an internal post/page selection.
Conditional Logic — Visible only when Link Image is checked.
External URL
- Attribute:
externalUrl - Type: Text field
- Default: Empty
- Panel: Link
What it controls — The full URL (including https://) that the image links to when "Link is external URL" is enabled.
Conditional Logic — Visible only when Link Image is checked AND Link is external URL is checked.
Post Type (link destination — unlabeled dropdown)
- Attribute:
linkPostType - Type: Single-select dropdown
- Default: Empty (no selection)
- Panel: Link
What it controls — Selects which content type to browse when choosing an internal link destination. Once a post type is selected, a second dropdown appears listing all published posts/pages of that type.
Options — Populated dynamically from the site's registered public post types (custom post types, pages, etc.). Attachment types are handled separately; the "custom" and "child-pages" pseudo-types are excluded.
Conditional Logic — Visible only when Link Image is checked AND Link is external URL is unchecked.
Post / Page Selection (link destination — unlabeled dropdown)
- Attribute:
linkPostId - Type: Single-select dropdown
- Default:
0(no selection) - Panel: Link
What it controls — Selects the specific post, page, or media file the image links to. The selected item's permalink (or, for attachments, the file URL) becomes the href of the wrapping <a> tag. Linking to an attachment opens the file in a new browser tab.
Conditional Logic — Visible only when Link Image is checked, Link is external URL is unchecked, and a Post Type has been selected. Only the dropdown matching the currently selected Post Type is shown.
Display Open Icon
- Attribute:
displayOpenIcon - Type: Checkbox
- Default:
true - Panel: Link
What it controls — When enabled, renders a small "open" SVG icon overlaid on the image to signal to visitors that the image is clickable and will open a destination. An icon background element is also rendered for contrast.
Conditional Logic — Visible only when Link Image is checked.
Open Icon Theme
- Attribute:
openIconTheme - Type: Radio buttons
- Default:
light - Panel: Link
What it controls — Controls the color treatment of the open icon overlay so it remains legible against the image behind it. The selected theme is also applied as a CSS class on the <figure> element.
Options
- Light — Uses a light-colored icon, suited for images with dark tones.
- Dark — Inverts the icon color for improved contrast against light or bright image backgrounds.
Conditional Logic — Visible only when Link Image is checked AND Display Open Icon is checked.
Hover Effect
- Attribute:
hoverEffect - Type: Multi-select dropdown (multiple values can be chosen simultaneously)
- Default: None (empty array)
- Panel: Link
What it controls — Applies one or more CSS animation classes to the <a> wrapper element that animate the image when a visitor hovers over it. Multiple effects can be combined.
Options
- None — No hover animation.
- Vertical Shift — The image shifts upward slightly on hover.
- Box Shadow — A box shadow appears on hover.
- Scale Down — The image shrinks slightly on hover.
- Scale Up — The image grows slightly on hover.
Conditional Logic — Visible only when Link Image is checked.
Cross-Block Relationships
The Image block is a standalone block with no required parent or child blocks. It can be placed inside any block that accepts arbitrary inner blocks (e.g. columns, containers, card layouts).
Theme-Level Integrations
Registered Image Sizes
The options available in the Image Size dropdown are drawn directly from the WordPress site's registered image sizes (set in functions.php or via plugins). The editor reflects the actual pixel dimensions of the selected image for each registered size when that data is available.
Theme Color Palette
The Border Color and Box Shadow Color pickers are limited to the site's theme color palette (defined in Theme Options / styleguide). Custom hex colors cannot be entered for these fields — only palette swatches are available.
Spacing Tokens
The Spacing margin options (Quarter, Half, BASE, Double, Triple) map to calc(var(--base-spacing) * n) CSS custom property values. The actual pixel size of each step is governed by the --base-spacing CSS variable set in the theme's styleguide.