Skip to content

Shortcode Reference

SnipShare overviewPremiumGet SnipShare →

SnipShare provides a [snipshare] shortcode that embeds a syntax-highlighted code viewer inline in any WordPress post, page, or widget.


[snipshare hash="abc123"]

Replace abc123 with the paste’s share_hash (visible in the paste URL: /paste/abc123).


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.


[snipshare hash="abc123"]
[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"]
[snipshare hash="abc123" lines="10-25"]
[snipshare hash="abc123" height="300"]
[snipshare hash="abc123" file="index.js" lines="1-50" height="400"]

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.


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

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
  • lines attribute uses 1-based line numbering (line 1 = first line)
  • When file does not match any filename in the paste, the first file is displayed instead
  • The height attribute applies a max-height CSS style with overflow-y: auto