Code Snippets

This is a collection of useful code snippets that can be used to achieve certain things in Simply Static. Some of them will be included in Simply Static in the future, others will stay as a code snippet.

Fire webhook after static export

You can use the following code snippet to send a request to an external service. I also added authentication as it’s needed for some services (GitHub for example):

Code Snippets 1

Run simply static with WP-Cron

This code snippet can be used to run different kinds of exports with Simply Static without touching the UI at all.

Code Snippets 2

Single Static Export after publishing a post

You may want to simplify your publishing workflow by automatically exporting a single page/post after you hit the publish button. Usually, this is done by clicking the “Export static” button within a post, but you can entirely automate that with the following code snippet:

Code Snippets 3