Adding Custom Code

CSS

# Top

CSS can be added to your site by going into Appearance->Customize->Additional CSS

The main thing to remember is that your appearance settings are tied to your theme! So, if you switch your theme and you want to keep the same CSS you will want to make sure to copy the content in your Additional CSS into the new theme!

PHP

# Top

PHP can be added a couple of places. The main place custom PHP can be added is to your function.php file.

This can be found under Appearance->Theme Editor. You will then select your current theme from the drop down and locate the function.php file in the content editor.

However, a safer way to add PHP is with a customizer plugin or a child theme, as any time you update your main theme the content added to the theme will be overwritten. This won’t happen with a child theme or a customizer plugin.

Customizers and Child Themes

# Top

LifterLMS has a code customizer plugin you can use here.

When you install the plugin you can add content to it by going into Plugins->Plugin Editor. Be sure the plugin is not activated yet when you edit it incase any code gets added incorrectly it will not then be active on the site and cause issues!

You can also use a Snippet plugin like this one: Code Snippets

When using a child theme you would add the content to the child theme’s functions.php file as well! This can be done under Appearance->Theme Editor.

Last Updated on
Was this article helpful?