BT-SVG-Viewer is available in the WordPress plugin directory. Search for bt-svg-viewer or go to https://wordpress.org/plugins/bt-svg-viewer/.
bt-svg-viewer.bt-svg-viewer folder into your WordPress installation at /wp-content/plugins/.[btsvviewer src="/wp-content/uploads/diagrams/system-map.svg"]
| Attribute | Type | Default | Description |
|---|---|---|---|
src |
string (required) | – | SVG URL. Supports absolute URLs, /absolute/path.svg, or relative to the uploads directory. |
height |
string | 600px |
CSS height of the viewer. Accepts px, vh, %, etc. |
class |
string | – | Additional class appended to the wrapper. |
zoom |
number | 100 |
Initial zoom percentage. |
min_zoom |
number | 25 |
Minimum zoom percentage allowed. |
max_zoom |
number | 800 |
Maximum zoom percentage allowed. |
zoom_step |
number | 10 |
Increment used by buttons/keyboard shortcuts. |
initial_zoom |
number | – | Alias captured when presets save the preview state. Overrides zoom if present. |
pan / pan_mode |
scroll or drag |
scroll |
Toggle between scroll-wheel panning and click-drag panning. Drag is enforced when zoom modes require it. |
zoom_mode / zoom_behavior / zoom_interaction |
super_scroll / scroll / click |
super_scroll |
Choose how wheel and modifier gestures zoom: Cmd/Ctrl + wheel (super_scroll), every wheel (scroll), or Cmd/Ctrl-click & Alt-click (click). |
center_x / center_y |
number | – | Manual center point in SVG units. Defaults to viewBox center. |
show_coords |
boolean | false |
Appends “Copy Center” button for debugging coordinate values. |
controls_position |
top/bottom/left/right |
top |
Placement of the entire control group. |
controls_buttons |
string | both |
Comma-delimited mode/align/button list. See table below (supports slider). |
title |
string | – | Optional heading above the viewer. HTML allowed. |
caption |
string | – | Optional caption below the viewer. HTML allowed. |
button_fill / button_background / button_bg |
color string | theme default (#0073aa) |
Button background color. Aliases exist for backwards compatibility (all map to button_fill). |
button_border |
color string | matches fill | Outline color for buttons. Blank inherits the fill color. |
button_foreground / button_fg |
color string | #ffffff |
Text and icon color for buttons. Blank uses the default. |
id |
number | – | Reference a saved preset (admin). Inline attributes override preset values. |
Changing the interaction defaults automatically inserts a helper caption (e.g. “Cmd/Ctrl-click to zoom in…”) above your custom caption so visitors know the gesture.
controls_buttons Cheat Sheetcontrols_buttons="MODE,ALIGNMENT,BUTTON_1,BUTTON_2,..."
Mode keywords (optional):
both (default)icontextcompactlabels_on_hoverminimalhidden / noneAlignment keywords (optional, anywhere in list):
alignleftaligncenteralignrightAdditional keywords:
slider – replaces zoom buttons with a live-updating range input. Combine with icon/text/both for layout. Use custom:slider,zoom_in,zoom_out to show both slider and buttons.Button names (pick any order):
zoom_in, zoom_out, reset, center, coords (coords button only renders if show_coords="true")Example:
[btsvviewer
src="/uploads/system-map.svg"
controls_position="right"
controls_buttons="slider,icon,aligncenter,reset,center"
]
WordPress Dashboard → BT SVG Viewer → Presets
| Field | Description |
|---|---|
| SVG Source URL | Choose or upload an SVG from the media library. Required before preview loads. |
| Viewer Height | Same as shortcode height. |
| Zoom Settings | Minimum, maximum, step, and initial zoom percentages. |
| Center Coordinates | Override auto centering with explicit center_x/center_y. |
| Controls Position | Dropdown for top, bottom, left, right. |
| Controls Buttons/Layout | Text field following the MODE,ALIGN,buttons… pattern described above. |
| Button Colors | Three color pickers for fill, border, and foreground (text/icon) colors. |
| Title & Caption | Optional, displayed above/below the viewer wrapper. |
show_coords is enabled, the button copies coordinates to the clipboard.[btsvviewer id="123"].dev. or wptest. and can be toggled manually when you need to defeat browser caching.Create or edit a preset as described above.
Copy the generated shortcode ([btsvviewer id="123"]).
Paste into:
do_shortcode().Override on a per-use basis if needed:
[btsvviewer id="123" controls_buttons="icon,alignright,zoom_in,zoom_out"]
show_coords to display the current x/y values of the viewport center.[btsvviewer src="/uploads/floorplan.svg"]
[btsvviewer
src="/uploads/system-map.svg"
height="100vh"
controls_position="bottom"
controls_buttons="compact,aligncenter,zoom_in,zoom_out,reset,center"
zoom="175"
min_zoom="50"
max_zoom="400"
]
[btsvviewer
id="42"
controls_buttons="custom:slider,zoom_in,zoom_out,reset"
]
[btsvviewer
src="/uploads/mind-map.svg"
show_coords="true"
controls_buttons="icon,alignleft,zoom_in,zoom_out,reset,center,coords"
]
[btsvviewer
src="/uploads/campus-map.svg"
button_bg="#2f855a"
button_border="#22543d"
button_fg="#ffffff"
controls_buttons="both,aligncenter,zoom_in,zoom_out,reset,center"
]
Wrapper classes added by the plugin:
.bt-svg-viewer-wrapper – outer container.bt-svg-viewer-main – wraps controls and SVG container.svg-controls – control bar.controls-position-{top|bottom|left|right}.controls-mode-{icon|text|both|compact|labels-on-hover|minimal}.controls-align-{alignleft|aligncenter|alignright}.bt-svg-viewer-btn, .btn-icon, .btn-text.svg-container, .svg-viewport, .coord-output, .zoom-display.zoom-slider-wrapper, .zoom-sliderButton colors are powered by CSS custom properties on the wrapper. Shortcode attributes and preset color pickers set these values, but you can override them manually:
.bt-svg-viewer-wrapper {
--bt-svg-viewer-button-fill: #1d4ed8;
--bt-svg-viewer-button-border: #1d4ed8;
--bt-svg-viewer-button-hover: #1e40af;
--bt-svg-viewer-button-text: #ffffff;
--bt-svg-viewer-slider-width: 240px; /* optional: tweak slider width */
}
Example overrides:
.bt-svg-viewer-wrapper.custom-map {
border-radius: 12px;
overflow: hidden;
}
.bt-svg-viewer-wrapper.custom-map .svg-controls {
background: #111;
color: #fff;
gap: 6px;
}
.bt-svg-viewer-wrapper.custom-map .bt-svg-viewer-btn {
background: rgba(255,255,255,0.1);
border: 1px solid rgba(255,255,255,0.3);
}
.bt-svg-viewer-wrapper.custom-map .bt-svg-viewer-btn:hover {
background: rgba(255,255,255,0.25);
}
viewBox.viewBox.controls_buttons for hidden or empty button list.Copy Center; the plugin falls back to a prompt.show_coords="true" or inspect window.btsvviewerInstances['viewer-id'] to troubleshoot zoom, center, or scroll behaviour.pan_mode="drag" or zoom_mode="scroll" / click", with the front end auto-explaining gesture hints to visitors.dev.* and wptest.* hosts) to force fresh JS/CSS while testing.Full changelog lives in the repository’s CHANGELOG.md.