Shortcode Reference
SnipShare provides a [snipshare] shortcode that embeds a syntax-highlighted code viewer inline in any WordPress post, page, or widget.
Basic Usage
Section titled “Basic Usage”[snipshare hash="abc123"]Replace abc123 with the paste’s share_hash (visible in the paste URL: /paste/abc123).
Attributes
Section titled “Attributes”| Attribute | Type | Default | Description |
|---|---|---|---|
id |
integer | 0 |
Paste ID (numeric). Alternative to hash. |
hash |
string | '' |
Paste share_hash. Alternative to id. |
file |
string | '' |
Filename to display for multi-file pastes. If omitted, all files are shown. |
lines |
string | '' |
Line range to display, e.g. 5-20. If omitted, all lines are shown. |
theme |
string | '' |
Prism.js theme class override. Reserved for future use. |
height |
integer | '' |
Maximum height in pixels. Adds vertical scrolling when content overflows. |
Either id or hash must be provided.
Examples
Section titled “Examples”Basic embed by hash
Section titled “Basic embed by hash”[snipshare hash="abc123"]Embed by paste ID
Section titled “Embed by paste ID”[snipshare id="42"]Show only one file from a multi-file paste
Section titled “Show only one file from a multi-file paste”[snipshare hash="abc123" file="helper.php"]Show only lines 10–25
Section titled “Show only lines 10–25”[snipshare hash="abc123" lines="10-25"]Limit display height with scroll
Section titled “Limit display height with scroll”[snipshare hash="abc123" height="300"]Combine options
Section titled “Combine options”[snipshare hash="abc123" file="index.js" lines="1-50" height="400"]Output
Section titled “Output”The shortcode outputs a <div class="snipshare-embed"> containing:
- A header bar with the paste title (linked to the paste page)
- Per-file headers (only shown for multi-file pastes)
<pre>blocks with Prism.js syntax highlighting classes
Prism.js assets are enqueued only when the shortcode is rendered. The theme follows the Appearance → Code Theme setting.
Access Control
Section titled “Access Control”| Paste type | Shortcode output |
|---|---|
| Public | Renders normally |
| Unlisted | Renders normally (shortcode has the hash, so it can access it) |
| Private (owner viewing) | Renders normally |
| Private (non-owner) | Shows: “This paste is private.” |
| Password-protected (unlocked) | Renders normally |
| Password-protected (locked) | Shows a locked placeholder with a link to the paste page |
| Not found / expired / trashed | Shows: “Paste not found.” |
In bbPress
Section titled “In bbPress”SnipShare shortcodes work natively inside bbPress topics and replies because bbPress runs do_shortcode() on its content by default. No extra configuration is needed.
The Insert Paste button (when enabled in Settings → Integrations) makes it easy for users to insert shortcodes without knowing the syntax.
- The shortcode is self-closing - content between opening and closing tags is ignored
linesattribute uses 1-based line numbering (line 1 = first line)- When
filedoes not match any filename in the paste, the first file is displayed instead - The
heightattribute applies amax-heightCSS style withoverflow-y: auto

