Where do I add my custom PHP code?

Inside the child theme

The best way to add your custom PHP code (small snippets) is in the functions.php file of your child theme. The functions file behaves like a WordPress Plugin, adding features and functionality to a WordPress site through PHP code. You can use it to call native PHP functions, WordPress functions, or to define your own functions.

  • flatsome-child
    • functions.php

Do not under any circumstance add PHP code in the  functions.php file of the parent theme! To keep your additions when you update the theme,  always use the functions.php file of your child theme.

By plugin

Alternatively, simply use a "functionality" plugin such as the Code Snippets plugin to manage your custom PHP snippets.