Skip to content

Shortcode

The shortcode outputs a Pixel image as an <img> tag wherever WordPress runs shortcodes, such as post content. It is the shortcode form of sleekPixel_get_image() and takes the same values.

Usage

Text

Attributes

  • id (required): the image’s ID.
  • key (required): a name for this use of the image. Pixel keeps one rendered file per image, post and key, so give each use its own key. The value is a single key; commas do not split it.
  • postid (optional): the post whose data fills the image. Defaults to the current post.
  • data (optional): JSON merged into the image’s dynamic data, such as data='{"post":{"title":"Custom title"}}'. Invalid JSON is ignored. It applies only in content whose author can publish unfiltered HTML (administrators and editors on a single site, super admins on a network); for any other author the image renders with its normal dynamic data. In PHP, sleekPixel_get_image() takes the same value without that limit.

Without id or key the shortcode outputs nothing.

Output

The shortcode returns an <img> tag with the canvas’s width and height and an empty alt. It returns nothing while the image has no rendered file yet, which happens on the first request with asynchronous processing or from a visitor who is not signed in, and when the server has no Imagick extension. While a changed design renders again, it returns the previous file.

In templates

In PHP, call sleekPixel_get_image() directly rather than through do_shortcode().

Stay in the Loop!  

Be the first to hear about new updates, special offers, and helpful tips, delivered straight to your inbox.

We respect your inbox (and your privacy). Read our privacy policy.