Shortcodes

Control your Postie posts with shortcodes!

With this AddOn not only can you control your title, post format, post type, comment control, post status, tags, categories, post date and excerpt using simple shortcodes, but there are new features as well.

Simply add the desired shortcodes in the body of the email.

New features not available in Postie

This AddOn also give you the ability to:

  • Insert an image from the media library
  • Set an image from the media library as the featured image
  • Insert custom fields
  • Mark a post as featured/sticky
  • Control pingbacks
  • Insert a “read more” marker
  • Insert a “next page” marker for multi-page posts
  • Set the author
  • Attach terms in custom taxonomies
  • Set the post slug
  • Set the parent page
  • Update/replace post
  • Add a password to a post

Add your own custom shortcodes. You can add you own Postie shortcodes as described here.

Examples

ppassword

[ppassword password="secure_password"]

This will add a password to the post.

preplace

[preplace]
[preplace post=121]
[preplace post="post_slug"]
[preplace post=121 posttype="*"]

To update a post create your email as usual then add [preplace] at the end. In order for Postie to know which post to replace your email subject must match the post title exactly or you can add the “post” attribute and specify either a post id or the post slug.

Optionally you can provide a posttype attribute to specify the post type you are replacing or “*” to indicate any posttype. Otherwise Postie will only replace a post if the posttype matches the default posttype.

pimage

[pimage id=101]

This will insert the image with id 101 into the post. The image is assigned the CSS class postie-shortcode-image if you want to style it. Typically you’d use this when you want to use an image already in your media list. Since the id is unknown ahead of time you can’t use this to specify an image in the email.

pslug

[pslug slug="my awesome slug"]

This will set the post slug to “my-awesome-slug”. Note that WordPress will “sanitize” anything you put in the slug value so that it is valid in a URL and that it is unique.

pfeatured

[pfeatured id=101]

This will assign the image with id 101 as the featured image for the post. Typically you’d use this when you want to use an image already in your media list. Since the id is unknown ahead of time you can’t use this to specify which image in the email should be the featured image.

psticky

[psticky]

This will make the post a featured/sticky post.

pmore

[pmore]

This will insert a “read more” marker into the post.

pnextpage

[pnextpage]

This will insert a page break into the post so that you can have multi-page posts.

ptitle

[ptitle title="My cool title"]

This change the title of the post to “My cool title” regardless of the subject line of the email.

pformat

[pformat format=quote]

This will change the post format to a quotation. Any post format your site supports can be selected.

ptype

[ptype type=page]

This will change the post type to a page. Any post type your site supports can be selected.

pcomments

[pcomments comments=closed]

This will close the post for comments.

ppings

[ppings pings=closed]

This will close the post for pingbacks.

pstatus

[pstatus status=draft]

This will set the post status as draft. publish, pending, private and future are also supported. If you have a custom status that is also supported.

ptag, ptags

[ptag tag=tag1]
[ptags tags="tag1, tag2"]

This allows you to set the tags on a post. Provide 1 tag or as many as you want separated by commas. You can also use this shortcode multiple times. Using this shortcode will override any default tags.

pcategory, pcategories

[pcategories categories="cat1, cat"]
[pcategory category=cat3]

This allows you to set the categories for a post. Provide one category or as many as you want separated by commas. You can specify the category name, slug or ID. Remember to use quotes if there are spaces in the name.

The categories must exist ahead of time. This also supports custom taxonomies. You can also use this shortcode multiple times. Using this shortcode will override any default category.

pdate

[pdate date="Jun 15, 2023"]
[pdate date="2023-05-17 10:00:00 CET"]

This allows you to specify the date for a post. Use this in combination with [pstatus future] to create scheduled posts. Note you have to use quotes if your date contains any spaces.

pexcerpt

[pexcerpt]The is my neato excerpt[/pexcerpt]

This will add an excerpt to your post.

pcustom

[pcustom name=fieldname value="my value"]
[pcustom name=fieldname]
my long value with
carriage returns.
[/pcustom]
[pcustom name="array{index}" value="array element value"]

This will add a custom field to the post set to the value. You can also use this shortcode multiple times. Note you can also reference an array in the name parameter. Due to WordPress limitations the array notation cannot use square brackets (i.e. don’t do [pcustom name=”array[index]” value=1]) rather use curly braces instead. There is currently no way to delete an array index, nor are multidimensional arrays supported (e.g. [pcustom name=”array{index1}{index2}” value=1] will not work).

Note that many email clients (Gmail & Outlook) will alter URLs so placing a URL in the value element may not work as expected. E.g. [pcustom name=”link” value=”https://example.com”] will get turned into [pcustom name=”link” value=”<a href=”https://example.com”>https://example.com</a>”]

pterm

[pterm taxonomy=taxonomyslug term=termslug]
[pterm taxonomy=taxonomyslug term="term1, term2"]

This will add term to the post from the custom taxonomy. Typically you would use this with custom post types that have their own taxonomy. You can use this shortcode multiple times. You can provide multiple terms if you separate them with commas. Note you may need to set the “Force User Login” setting to “Yes” to use custom taxonomies.

pauthor

[pauthor author=1]
[pauthor author="wayne@postieplugin.com"]

This will change the author to the indicated WordPress user. You can specify by id, slug, email or login.

pparent

[pparent parent=1]
[pparent parent=page-slug]
[pparent parent="page title"] 

This will change the page parent to the indicated page. You can specify the parent by id, slug or title.

Release Notes

1.2.16 released 2021-08-31

  • preplace now moves meta data.

1.2.15 released 2021-08-10

  • Add ability to use preplace with post id or slug in addition to title/subject.

1.2.14 released 2020-09-29

1.2.13 released 2019-12.09

  • Updated the update checker

1.2.12 released 2019-11-27

  • Feature: Add ppassword to add a password to the post.

1.2.11 released 2019-08-03

  • Fix: Logic to find post to replace with preplace

1.2.10 released 2019-08-03

  • Feature: Add preplace to replace/update an existing page.

1.2.9 released 2018-11-17

  • Feature: Add pparent to set parent page

1.2.8 released 2017-12-05

  • Feature: pcustom can now specify the value between the tags rather than as an attribute for more complex values.

1.2.7 released 2017-10-27

  • Fix: Don’t process if previous filter cleared the post.

1.2.6 released 2017-04-12

  • pterm now allows multiple terms to be specified.

1.2.5 released 2017-04-05

  • Fix issue with pdate
  • Add autoupdater

1.2.4 released 2017-02-12

  • Fixed an issue with the new array support with pcustom

1.2.3 released 2017-02-07

  • Add support for array references in pcustom

1.2.2 released 2016-12-06

  • Added pslug

1.2.1 released 2016-07-28

  • Added pimage
  • Added pfeatured
  • Now using official shortcode format. [shortcode param=value]

1.1.7 released 2016-06-01

  • Fixed a bug with pmore

1.1.6 released 2015-12-04

  • Added pauthor

1.1.5 released 2015-11-19

  • Added pnextpage

1.1.4 released 2015-09-18

  • Additional logging for taxonomies

1.1.3 released 2015-09-14

  • Fix multiple categories in a single shortcode
  • Fix initial category/tag detection when there are multiple messages

1.1.2 released 2015-09-10

  • Fix html entity encoding of quoted parameters

1.1.1 released 2015-06-26

  • The first category or tag shortcode removes the default

1.1.0 released 2015-05-20

  • Added pterm

1.0.3 released 2015-05-11

  • Fix where other shortcodes were running

1.0.2 released 2015-05-11

  • Fix bug where multiple categories not getting set

1.0.2 released 2015-04-29

  • Initial release