Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

All docs

Your first snippet

This adds a line of text to the footer of every page.

  1. Go to Snipfire → Snippets and click + New.
  2. Choose PHP in the type picker.
  3. Paste this:
add_action( 'wp_footer', function () {
    echo '<p>Hello from my first snippet.</p>';
} );
  1. Give it a name, then click Save (or press Ctrl/Cmd+S).
  2. Turn on the Active switch.

Open your site: the line is at the bottom of the page.

What just happened

  • When you saved, Snipfire checked the code for syntax errors. A broken snippet isn't saved until you fix it, and the problem is marked on its line.
  • When you switched it on, Snipfire test-loaded your site with the snippet. If that had failed, the snippet would have gone straight back off.
  • If it fails later, for example only on one page, Snipfire switches it off and shows a notice with the exact line.

Tip: type add_action( ' and pick a hook from the list. The editor writes the whole callback for you, with the right parameters.

Next: Safe mode.

Something unclear or missing? Tell us