Installation

Via WordPress Plugin directory

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/.

Manual Installation

  1. Unzip the plugin archive
  2. Upload the plugin
  3. Activate

Quick Start

[btsvviewer src="/wp-content/uploads/diagrams/system-map.svg"]

Shortcode Reference

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.

  1. SVG Viewer with left sidebar

controls_buttons Cheat Sheet

controls_buttons="MODE,ALIGNMENT,BUTTON_1,BUTTON_2,..."

Mode keywords (optional):

Alignment keywords (optional, anywhere in list):

Additional keywords:

Button names (pick any order):

Example:

[btsvviewer
  src="/uploads/system-map.svg"
  controls_position="right"
  controls_buttons="slider,icon,aligncenter,reset,center"
]

Admin Preset Editor

  1. SVG Preset Editor

Location

WordPress Dashboard → BT SVG Viewer → Presets

Fields

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.

Preview Pane

Preset Shortcodes

Defaults Tab


Using Presets in Posts/Pages

  1. Create or edit a preset as described above.

  2. Copy the generated shortcode ([btsvviewer id="123"]).

  3. Paste into:

  4. Override on a per-use basis if needed:

    [btsvviewer id="123" controls_buttons="icon,alignright,zoom_in,zoom_out"]
    

Preview Workflow

  1. Load / Refresh Preview once the SVG path is entered.
  2. Drag or scroll the SVG to the desired default view.
  3. Use Current View for Initial State to stash those coordinates/zoom.
  4. Optionally toggle show_coords to display the current x/y values of the viewport center.
  5. Save/publish the preset and test the shortcode on the front end.

Examples

[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"
]

Styling (CSS Hooks)

Wrapper classes added by the plugin:

Button 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);
}

Tips & Troubleshooting

SVG Preparation

Common Issues

Debugging


Changelog Highlights (1.1.0)

Full changelog lives in the repository’s CHANGELOG.md.


License & Credits