2. Documentation
  3. Extending & Styling
  4. How-to use custom PHP code snippets

How-to use custom PHP code snippets

There might be a situation where you need to use some custom PHP code snippets on your site.

This could be done by adding the code into the functions.php of your child-/theme. Unfortunately after changing your theme, your snippets will be gone too.

Alternatively you could create your own plugin and collect those snippets inside. Of course this requires deeper technical programming knowledge.

The easy way of handling PHP code snippets

We recommend making use of a plugin called Code Snippets which is available for free.

After you installed and activated the plugin, you can find a new menu entry called “Snippets” on your left. Here you can add multiple snippets, control where the snippet should be executed, assign a title and description.

Additionally you can easily deactivate snippets in order to pause their execution, without deleting them completely.

Was this article helpful?

Related Articles