Switch from Post Snippets
Snipfire imports the shortcode snippets you made in Post Snippets, with their variables, and switches them over without a gap. Read Switching from another snippet plugin first for how importing, Check first and Switch over work.
Steps
- Snipfire → Snippets → Import, then pick Post Snippets.
- Select the snippets and click Import … selected. They arrive switched off in Imported/Post Snippets.
- Read the notes in the snippets' descriptions.
- Click Switch over.
- Clear your page cache, check the pages that use the shortcodes, then deactivate and delete Post Snippets.
Command line: wp snipfire import-from post-snippets --dry-run, then wp snipfire import-from post-snippets --switch.
What comes across
In Post Snippets, a snippet either runs on the site as a shortcode, or is text that Post Snippets pastes into a post while you write it. Only the shortcodes run on your site, so only they are imported.
| Post Snippets | In Snipfire |
|---|---|
| Title, description | Title, description |
| A shortcode snippet with PHP ticked | A PHP snippet, As a shortcode |
| Any other shortcode snippet | An HTML snippet, As a shortcode |
| The shortcode name (the snippet's title) | The same custom Shortcode tag, when the title is a valid tag (lowercase letters, numbers, - and _) |
Variables, such as color=red |
Shortcode attributes with the same defaults: [my_snippet color="blue"] still works |
{name} placeholders in the code |
The attribute's value, printed as Post Snippets printed it |
Typed placeholders: {name:url}, {name:text}, {name:attr}, {name:xml}, {name:textarea} |
The value, escaped the same way (esc_url(), esc_html() …) |
{content} |
The text between the opening and closing shortcode |
| Shortcodes inside a snippet that isn't PHP | Still run |
| On or off | Imported switched off; switched on by Switch over if it was on |
The placeholders become a few lines of PHP at the top of the snippet that read the shortcode's attributes. You can leave them as they are.
Snippets whose Shortcode box wasn't ticked are listed with Not a shortcode: Post Snippets pastes this text into posts while you write, so nothing of it runs on the site. and aren't imported. The text Post Snippets pasted is already in your posts.
Close, but not identical
- wptexturize: if a snippet had this ticked, Post Snippets turned straight quotes into curly ones and hyphens into dashes. Snipfire prints the text as written. The note tells you when this applies.
<?phpin a snippet that isn't PHP: Post Snippets printed it as text, so Snipfire escapes it to print as text too.
Shortcodes
Each Post Snippets shortcode is named after its snippet, for example [my_snippet]. After switching over, that shortcode runs the Snipfire copy, even with Post Snippets deleted. You don't need to edit your posts.
To see where the shortcodes are used, use Tools & Safe Mode → Shortcodes in your content. See Find where shortcodes are used.
Switching over
Snipfire switches each snippet off in Post Snippets' own table, then switches the copy on and test-loads the site.
Very old versions of Post Snippets (before version 3) keep snippets in a different place, which Snipfire can import from but can't switch off: This is an old Post Snippets version: update Post Snippets first, or switch the snippet off there yourself.
Something unclear or missing? Tell us