How to add a code to the theme header or footer
We do not recommend the alteration of the theme files. This can cause malfunctions and can break the theme functionalities. If you need to make code customizations, the Child themes are the recommended way of modifying an existing theme.
If you are not a developer and you are not familiar with deep theme customization using the child theme, or you are simply looking for a small task such as adding Facebook pixel code to the header theme or something similar:
Follow the next steps to add a code to the theme header without touching the code.
- 1
-
Install a dedicated WordPress plugin that helps you to add codes to the theme header. In this example we will use this plugin:
Insert Headers and Footers.
- 2
-
Go to
WP Admin > Settings > Insert Headers and Footers
- 3
-
Save.
Javascript conflict
After saving the plugin options, visit a page and check the Live Composer usage. If there are JS errors mentioned with the ladybug tool, means your script code added causes malfunctions. Check for more details on this article: Troubleshooting: JavaScript error detected