Skip to content

The [snipshare] Shortcode

Use the [snipshare] shortcode to embed a syntax-highlighted code viewer for any paste inside a post, page, or widget.

Reference a paste by its share hash or numeric ID:

[snipshare hash="abc123def456"]
[snipshare id="42"]

Provide either hash or id. If both are given, id takes precedence.

Attribute Default Description
hash (empty) The paste’s share hash.
id 0 The paste’s numeric ID (alternative to hash).
file (empty) For multi-file pastes, the filename to display. Omit to show all files. If the named file is not found, the first file is shown.
lines (empty) A line range to display, for example 5-20. Omit to show all lines.
height (empty) Maximum height in pixels; adds a scrollbar when the content is taller.
theme (empty) Reserved for a future Prism theme override; currently has no effect.

Show only one file from a multi-file paste:

[snipshare hash="abc123def456" file="app.js"]

Show lines 10–25 with a capped height:

[snipshare hash="abc123def456" lines="10-25" height="300"]
  • The shortcode respects visibility: private pastes are shown only to their owner; others see “This paste is private.”
  • Password-protected pastes that have not been unlocked in the current session show a locked placeholder linking to the full paste page.
  • If the paste does not exist, is not active, or has no files, a short error message is shown instead.
  • The shortcode always outputs something (content, a locked notice, or an error), never an empty string.

You do not always need the shortcode. Because SnipShare registers itself as an oEmbed provider, pasting a bare paste URL (https://yoursite.com/paste/{hash}) on its own line in a post also renders an embedded preview. See oEmbed.